Guest User

Untitled

a guest
Feb 19th, 2018
79
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.75 KB | None | 0 0
  1. /*
  2. * Socket.h
  3. *
  4. * Created on: Oct 24, 2011
  5. * Author: justin
  6. */
  7.  
  8. #ifndef SOCKET_H_
  9. #define SOCKET_H_
  10. #include <string>
  11. #include <string.h>
  12. #include <sys/socket.h>
  13. #include <sys/types.h>
  14. #include <netinet/in.h>
  15. #include <stdlib.h>
  16. class Socket {
  17. struct sockaddr_in {
  18. short int sin_family;
  19. unsigned short int sin_port;
  20. struct in_addr sin_addr;
  21. unsigned char sin_zero[8];
  22. };
  23. struct sockaddr_in addr;
  24. int sock;
  25. int n_sock;
  26. socklen_t addrlen;
  27. struct addr;
  28. void copyStr(char newStr[], char oldStr[]);
  29. public:
  30. Socket();
  31. void setPort(int port);
  32. void sBind();
  33. void sListen(int conn);
  34. void sAccept();
  35. void sSend(std::string msg);
  36. //void sRecv(int buffer);
  37. void sClose();
  38. };
  39.  
  40. #endif /* SOCKET_H_ */
Add Comment
Please, Sign In to add comment