Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- /*
- * Socket.h
- *
- * Created on: Oct 24, 2011
- * Author: justin
- */
- #ifndef SOCKET_H_
- #define SOCKET_H_
- #include <string>
- #include <string.h>
- #include <sys/socket.h>
- #include <sys/types.h>
- #include <netinet/in.h>
- #include <stdlib.h>
- class Socket {
- struct sockaddr_in {
- short int sin_family;
- unsigned short int sin_port;
- struct in_addr sin_addr;
- unsigned char sin_zero[8];
- };
- struct sockaddr_in addr;
- int sock;
- int n_sock;
- socklen_t addrlen;
- struct addr;
- void copyStr(char newStr[], char oldStr[]);
- public:
- Socket();
- void setPort(int port);
- void sBind();
- void sListen(int conn);
- void sAccept();
- void sSend(std::string msg);
- //void sRecv(int buffer);
- void sClose();
- };
- #endif /* SOCKET_H_ */
Add Comment
Please, Sign In to add comment