[rnet] Renamed some functions
This commit is contained in:
parent
e176a476c0
commit
42dad5df95
8 changed files with 83 additions and 83 deletions
|
@ -131,7 +131,7 @@ int main(void)
|
|||
InitNetworkDevice(); // Init network communications
|
||||
|
||||
// Create the server: getaddrinfo + socket + setsockopt + bind + listen
|
||||
serverResult = AllocSocketResult();
|
||||
serverResult = LoadSocketResult();
|
||||
if (!SocketCreate(&serverConfig, serverResult))
|
||||
{
|
||||
TraceLog(LOG_WARNING, "Failed to open server: status %d, errno %d", serverResult->status, serverResult->socket->status);
|
||||
|
@ -155,7 +155,7 @@ int main(void)
|
|||
}
|
||||
|
||||
// Create the client: getaddrinfo + socket + setsockopt + connect (TCP only)
|
||||
clientResult = AllocSocketResult();
|
||||
clientResult = LoadSocketResult();
|
||||
if (!SocketCreate(&clientConfig, clientResult))
|
||||
{
|
||||
TraceLog(LOG_WARNING, "Failed to open client: status %d, errno %d", clientResult->status, clientResult->socket->status);
|
||||
|
@ -172,7 +172,7 @@ int main(void)
|
|||
}
|
||||
|
||||
// Create and add sockets to the socket set
|
||||
socketSet = AllocSocketSet(3);
|
||||
socketSet = LoadSocketSet(3);
|
||||
|
||||
AddSocket(socketSet, serverResult->socket);
|
||||
AddSocket(socketSet, clientResult->socket);
|
||||
|
|
|
@ -28,7 +28,7 @@ int main(void)
|
|||
char buffer[ADDRESS_IPV6_ADDRSTRLEN];
|
||||
unsigned short port = 0;
|
||||
|
||||
AddressInformation *address = AllocAddressList(1);
|
||||
AddressInformation *address = LoadAddressList(1);
|
||||
|
||||
// Address info flags
|
||||
// ADDRESS_INFO_NUMERICHOST // or try them in conjunction to
|
||||
|
|
|
@ -46,7 +46,7 @@ int main(void)
|
|||
char receiveBuffer[512] = { 0 };
|
||||
|
||||
// Create the client: getaddrinfo + socket + setsockopt + connect (TCP only)
|
||||
clientResult = AllocSocketResult();
|
||||
clientResult = LoadSocketResult();
|
||||
if (!SocketCreate(&clientConfig, clientResult)) TraceLog(LOG_WARNING, "Failed to open client: status %d, errno %d", clientResult->status, clientResult->socket->status);
|
||||
else
|
||||
{
|
||||
|
@ -57,7 +57,7 @@ int main(void)
|
|||
}
|
||||
|
||||
// Create and add sockets to the socket set
|
||||
socketSet = AllocSocketSet(1);
|
||||
socketSet = LoadSocketSet(1);
|
||||
AddSocket(socketSet, clientResult->socket);
|
||||
|
||||
SetTargetFPS(60); // Set our game to run at 60 frames-per-second
|
||||
|
|
|
@ -50,7 +50,7 @@ int main(void)
|
|||
char receiveBuffer[512] = { 0 };
|
||||
|
||||
// Create the server: getaddrinfo + socket + setsockopt + bind + listen
|
||||
serverResult = AllocSocketResult();
|
||||
serverResult = LoadSocketResult();
|
||||
if (!SocketCreate(&serverConfig, serverResult))
|
||||
{
|
||||
TraceLog(LOG_WARNING, "Failed to open server: status %d, errno %d", serverResult->status, serverResult->socket->status);
|
||||
|
@ -71,7 +71,7 @@ int main(void)
|
|||
}
|
||||
|
||||
// Create and add sockets to the socket set
|
||||
socketSet = AllocSocketSet(2);
|
||||
socketSet = LoadSocketSet(2);
|
||||
AddSocket(socketSet, serverResult->socket);
|
||||
|
||||
SetTargetFPS(60); // Set our game to run at 60 frames-per-second
|
||||
|
|
|
@ -23,17 +23,17 @@ void test_network_initialise()
|
|||
|
||||
void test_socket_result()
|
||||
{
|
||||
SocketResult *result = AllocSocketResult();
|
||||
SocketResult *result = LoadSocketResult();
|
||||
assert(result != NULL);
|
||||
FreeSocketResult(&result);
|
||||
UnloadSocketResult(&result);
|
||||
assert(result == NULL);
|
||||
}
|
||||
|
||||
void test_socket()
|
||||
{
|
||||
Socket *socket = AllocSocket();
|
||||
Socket *socket = LoadSocket();
|
||||
assert(socket != NULL);
|
||||
FreeSocket(&socket);
|
||||
UnloadSocket(&socket);
|
||||
assert(socket == NULL);
|
||||
}
|
||||
|
||||
|
@ -84,7 +84,7 @@ void test_resolve_host()
|
|||
{
|
||||
const char *address = "localhost";
|
||||
const char *port = "80";
|
||||
AddressInformation *addr = AllocAddressList(3);
|
||||
AddressInformation *addr = LoadAddressList(3);
|
||||
int count = ResolveHost(address, port, ADDRESS_TYPE_ANY, 0, addr);
|
||||
|
||||
assert(GetAddressFamily(addr[0]) == ADDRESS_TYPE_IPV6);
|
||||
|
@ -105,9 +105,9 @@ void test_address_list()
|
|||
void test_socket_create()
|
||||
{
|
||||
SocketConfig server_cfg = { .host = "127.0.0.1", .port = "8080", .server = true, .nonblocking = true };
|
||||
Socket *socket = AllocSocket();
|
||||
SocketResult *server_res = AllocSocketResult();
|
||||
SocketSet *socket_set = AllocSocketSet(1);
|
||||
Socket *socket = LoadSocket();
|
||||
SocketResult *server_res = LoadSocketResult();
|
||||
SocketSet *socket_set = LoadSocketSet(1);
|
||||
|
||||
assert(SocketCreate(&server_cfg, server_res));
|
||||
assert(AddSocket(socket_set, server_res->socket));
|
||||
|
|
|
@ -45,14 +45,14 @@ int main(void)
|
|||
char receiveBuffer[512] = { 0 };
|
||||
|
||||
// Create the client: getaddrinfo + socket + setsockopt + connect (TCP only)
|
||||
clientResult = AllocSocketResult();
|
||||
clientResult = LoadSocketResult();
|
||||
if (!SocketCreate(&clientConfig, clientResult))
|
||||
{
|
||||
TraceLog(LOG_WARNING, "Failed to open client: status %d, errno %d", clientResult->status, clientResult->socket->status);
|
||||
}
|
||||
|
||||
// Create and add sockets to the socket set
|
||||
socketSet = AllocSocketSet(1);
|
||||
socketSet = LoadSocketSet(1);
|
||||
AddSocket(socketSet, clientResult->socket);
|
||||
|
||||
SetTargetFPS(60); // Set our game to run at 60 frames-per-second
|
||||
|
|
|
@ -46,13 +46,13 @@ int main(void)
|
|||
char receiveBuffer[512] = { 0 };
|
||||
|
||||
// Create the server: getaddrinfo + socket + setsockopt + bind + listen
|
||||
serverResult = AllocSocketResult();
|
||||
serverResult = LoadSocketResult();
|
||||
|
||||
if (!SocketCreate(&serverConfig, serverResult)) TraceLog(LOG_WARNING, "Failed to open server: status %d, errno %d", serverResult->status, serverResult->socket->status);
|
||||
else if (!SocketBind(&serverConfig, serverResult)) TraceLog(LOG_WARNING, "Failed to bind server: status %d, errno %d", serverResult->status, serverResult->socket->status);
|
||||
|
||||
// Create and add sockets to the socket set
|
||||
socketSet = AllocSocketSet(1);
|
||||
socketSet = LoadSocketSet(1);
|
||||
AddSocket(socketSet, serverResult->socket);
|
||||
|
||||
SetTargetFPS(60); // Set our game to run at 60 frames-per-second
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue