Thread Rating:
  • 1 Vote(s) - 5 Average
  • 1
  • 2
  • 3
  • 4
  • 5
socket.h (made by me) a.k.a file header untuk C++ socket programming....... :D
#1
/*c0ded by Paulus 'deathfinger' Gandung
a.k.a syn-attack
a.k.a mercenary in network
quote : "brainmind is not dependable by your title and your achievement, but by your capability"
*/

#ifndef SOCKET_H
#define SOCKET_H
#include <WinSock2.h>
#include <string>

enum TypeSocket {BlockingSocket, NonBLockingSocket};

class Socket {
public :

virtual ~Socket();
Socket(const Socket&);
Socket& operator = (Socket&);

std::string ReceiveLine();
std::string ReceiveBytes();

void Close();

// the parameter of SendLine is not a const reference
// because SendLine modifies the std::string passed
void SendLine(std::string);

// the parameter of SendBytes is a const reference
// because SendBytes does not modify the std::string passed
// (in contrast to SendLine)
void SendBytes(const std::string&);
protected :
friend class SocketServer;
friend class SocketSelect;

Socket(SOCKET s);
Socket();

SOCKET s_;

int* refCounter_;

private :
static void Start();
static void End();
static int nofSockets_;
};

class SocketClient : public Socket {
public :
SocketClient(const std::string& host, int port);
};

class SocketServer : public Socket {
public :
SocketServer(int port, int connections, TypeSocket type = BlockingSocket);

Socket* Accept();
};

class SocketSelect {
public :
SocketSelect(Socket const * const s1, Socket const * const s2 = NULL, TypeSocket type = BlockingSocket);

bool Readable(Socket const * const s);

private :
fd_set fds_;
};

#endif
Reply
#2
sedap./.ijin explore sourcenya
cendol untuk mu
Reply
#3
simpan dengan nama socket.h ya kak sidom...... :D
kalau ada yang salah mohon untuk dimaafkan ya kak...... :D
Reply
#4
Izin Mempelajarinya yah...
Reply
#5
<html>
<head>
<title>gandungred</title>
</head>
<body text = "red" align = "center">
"brainmind is not dependable by your title and achievement, but by your capability"
</body>
</html>
oke kak MYGO.....
boleh kak,, monggo,, memang code ini dibuat opensource......
Reply
#6
wow , ini lebih oop keknya *soktau
Knowledge is DELICIOUS

Reply
#7
@kak bi0zc0de~# benr banget kak..... ini mengarah ke OOP (pemrograman berbasis obyek)........ :D

c0py paste aja kak bi0zcode,, ini opensource koq.....

hahahahahhaha :D
Reply
#8
@ all : file header ini lumayan,, lumayan untuk menambah library di visual C++ 2010....

heheh :D
Reply


Possibly Related Threads…
Thread Author Replies Views Last Post
Online-offline_16 Apps ( GNU/Linux ) Untuk Coding ( Support Zen Coding ) OneCThree 7 110 06-28-2014, 09:13 AM
Last Post: OneCThree
Wah-yellow_16 [HELP] Add-ons untuk Mozilla hogyz 3 68 09-25-2013, 10:28 PM
Last Post: hogyz
  ( help ) bikin aplikasi untuk database klien gwenbi 0 62 04-02-2012, 12:42 PM
Last Post: gwenbi
  Black Calc V.1 [C Programming] ./blacknotes 8 156 07-09-2011, 02:00 AM
Last Post: Dika_xb
  Zip Each File in Directory into Separate .zip Files With 7zip h4ntu_cr3w 0 21 03-28-2011, 02:47 PM
Last Post: h4ntu_cr3w
  [ask] C# Compiler untuk XP SP2 or fedora 9 c0ltz 4 53 03-10-2011, 06:03 PM
Last Post: veter
Wah-yellow_16 <kecewa> programming yang opensource masih gak ada tread nya xnagacode 14 236 12-09-2010, 01:18 PM
Last Post: mydisha
  aplikasi love untuk hape [ j2me] Dika_xb 7 159 11-10-2010, 09:18 PM
Last Post: Up_
  37 Applikasi untuk download Torrent Wayc0de 12 154 10-18-2010, 07:22 AM
Last Post: Wayc0de
Nut_16 AntiVirus with Batch File Hyda 13 227 10-08-2010, 04:27 PM
Last Post: Hyda

Forum Jump:


Users browsing this thread: 1 Guest(s)