Netsocket changes
This commit is contained in:
@@ -16,7 +16,7 @@ SOCKET plat_netsocket_create_server(int type, unsigned short port);
|
|||||||
void plat_netsocket_close(SOCKET socket);
|
void plat_netsocket_close(SOCKET socket);
|
||||||
|
|
||||||
SOCKET plat_netsocket_accept(SOCKET socket);
|
SOCKET plat_netsocket_accept(SOCKET socket);
|
||||||
int plat_netsocket_connected(SOCKET socket);
|
int plat_netsocket_connected(SOCKET socket); /* Returns -1 on trouble. */
|
||||||
int plat_netsocket_connect(SOCKET socket, const char* hostname, unsigned short port);
|
int plat_netsocket_connect(SOCKET socket, const char* hostname, unsigned short port);
|
||||||
|
|
||||||
/* Returns 0 in case of inability to send. -1 in case of errors. */
|
/* Returns 0 in case of inability to send. -1 in case of errors. */
|
||||||
|
@@ -80,6 +80,9 @@ int plat_netsocket_connected(SOCKET socket)
|
|||||||
{
|
{
|
||||||
struct sockaddr addr;
|
struct sockaddr addr;
|
||||||
socklen_t len = sizeof(struct sockaddr);
|
socklen_t len = sizeof(struct sockaddr);
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
if (getpeername(socket, &addr, &len) == SOCKET_ERROR)
|
if (getpeername(socket, &addr, &len) == SOCKET_ERROR)
|
||||||
return 0;
|
return 0;
|
||||||
|
|
||||||
@@ -113,6 +116,8 @@ int plat_netsocket_connect(SOCKET socket, const char* hostname, unsigned short p
|
|||||||
|
|
||||||
if (error == WSAEISCONN)
|
if (error == WSAEISCONN)
|
||||||
return 0;
|
return 0;
|
||||||
|
|
||||||
|
res = -1;
|
||||||
}
|
}
|
||||||
return res;
|
return res;
|
||||||
}
|
}
|
||||||
|
Reference in New Issue
Block a user