diff options
author | Tobias Weimer <wishmaster51@googlemail.com> | 2012-08-21 15:23:54 +0000 |
---|---|---|
committer | Tobias Weimer <wishmaster51@googlemail.com> | 2012-08-21 15:23:54 +0000 |
commit | 260cf26dec30e33ae3c7c6a91fccc0b4b43b8ce4 (patch) | |
tree | d2718f2979852832740f5eb1854e6e9b6d5dc7ed /plugins/!NotAdopted/Xfire/xfiretest/socket.h | |
parent | 3abc8a4dcba551b8a3a01fcc1b7c311dff5eaf32 (diff) |
latest XFire plugin sources by dufte (thanks)
No adaptions, uploaded as-is
git-svn-id: http://svn.miranda-ng.org/main/trunk@1514 1316c22d-e87f-b044-9b9b-93d7a3e3ba9c
Diffstat (limited to 'plugins/!NotAdopted/Xfire/xfiretest/socket.h')
-rw-r--r-- | plugins/!NotAdopted/Xfire/xfiretest/socket.h | 67 |
1 files changed, 67 insertions, 0 deletions
diff --git a/plugins/!NotAdopted/Xfire/xfiretest/socket.h b/plugins/!NotAdopted/Xfire/xfiretest/socket.h new file mode 100644 index 0000000000..370aeb74f7 --- /dev/null +++ b/plugins/!NotAdopted/Xfire/xfiretest/socket.h @@ -0,0 +1,67 @@ +// Copied from http://linuxgazette.net/issue74/tougher.html +// (only slightly modified) + + +// Definition of the Socket class + + +#ifndef Socket_class +#define Socket_class + +#include "stdafx.h" + +#include <sys/types.h> +//#include <netinet/in.h> +//#include <netdb.h> +//#include <unistd.h> +#include <string> +//#include <arpa/inet.h> +#include <winsock2.h> + +#include "socketexception.h" + + +const int MAXHOSTNAME = 200; +const int MAXCONNECTIONS = 5; +const int MAXRECV = 500; + +class Socket +{ + public: + //proxy hinzugefügt dufte + Socket( std::string host, int port,int useproxy = 0,std::string proxyhost = " ", int proxyport = 0 ); + virtual ~Socket(); + + // Server initialization + bool create(); + bool bind ( const int port ); + bool listen() const; + bool accept ( Socket& ) const; + + // Client initialization + bool connect ( const std::string host, const int port, int useproxy,std::string proxyhost,int proxyport); + + // Data Transimission + bool send ( char *buf, int length ) const; + bool send ( const std::string ) const; + int recv ( std::string& ) const; + int recv ( char *buf, int maxlen ) const; + + + void set_non_blocking ( const bool ); + + bool is_valid() const { return true; } + + int m_sock; + + private: + + + sockaddr_in m_addr; + HANDLE netlibcon; + + +}; + + +#endif |