customized SNICInterface
Fork of NySNICInterface by
Diff: Socket/TCPSocketConnection.h
- Revision:
- 12:0254eaccfda2
- Parent:
- 4:99cc93fe7d88
- Child:
- 14:54378c96d285
diff -r c49007d49e52 -r 0254eaccfda2 Socket/TCPSocketConnection.h --- a/Socket/TCPSocketConnection.h Wed Mar 19 01:48:37 2014 +0000 +++ b/Socket/TCPSocketConnection.h Tue Mar 25 01:42:25 2014 +0000 @@ -36,33 +36,34 @@ TCPSocketConnection(); /** Connects this TCP socket to the server - \param host The host to connect to. It can either be an IP Address or a hostname that will be resolved with DNS. - \param port The host's port to connect to. - \return 0 on success, -1 on failure. + @param host The ip address to connect to.(hexadecimal)("192.168.0.1"->0xC0A80001) + @param port The host's port to connect to. + @return 0 on success, -1 on failure. + @note This function is blocked until a returns. + When you use it by UI thread, be careful. */ - int connect(const char* host, const int port); + int connect( unsigned int ip_addr, unsigned short port ); /** Check if the socket is connected - \return true if connected, false otherwise. + @return true if connected, false otherwise. */ bool is_connected(void); /** Send data to the remote host. - \param data The buffer to send to the host. - \param length The length of the buffer to send. - \return the number of written bytes on success (>=0) or -1 on failure + @param data The buffer to send to the host. + @param length The length of the buffer to send. + @return the number of written bytes on success (>=0) or -1 on failure */ - int send(char* data, int length); + int send(unsigned char *data_p, int length); /** Receive data from the remote host. - \param data The buffer in which to store the data received from the host. - \param length The maximum length of the buffer. - \return the number of received bytes on success (>=0) or -1 on failure + @param data The buffer in which to store the data received from the host. + @param length The maximum length of the buffer. + @return the number of received bytes on success (>=0) or -1 on failure */ - int receive(char* data, int length); + int receive(unsigned char *data_p, int length); private: - bool _is_connected; }; }