InitWindow(screenWidth,screenHeight,"raylib [network] example - udp server");
InitNetworkDevice();
// Create the server
// Create the server
//
//
@ -104,31 +94,47 @@ int main()
// bind
// bind
// listen
// listen
server_res=AllocSocketResult();
server_res=AllocSocketResult();
if(!SocketCreate(&server_cfg,server_res)){
TraceLog(LOG_WARNING,"Failed to open server: status %d, errno %d",
server_res->status,server_res->socket->status);
}else{
if(!SocketBind(&server_cfg,server_res)){
TraceLog(LOG_WARNING,"Failed to bind server: status %d, errno %d",
server_res->status,server_res->socket->status);
}
if(!SocketCreate(&server_cfg,server_res))
{
TraceLog(LOG_WARNING,"Failed to open server: status %d, errno %d",server_res->status,server_res->socket->status);
}else
{
if(!SocketBind(&server_cfg,server_res))TraceLog(LOG_WARNING,"Failed to bind server: status %d, errno %d",server_res->status,server_res->socket->status);
}
}
// Create & Add sockets to the socket set
// Create & Add sockets to the socket set
socket_set=AllocSocketSet(1);
socket_set=AllocSocketSet(1);
msglen=strlen(pingmsg)+1;
msglen=strlen(pingmsg)+1;
memset(recvBuffer,'\0',sizeof(recvBuffer));
memset(recvBuffer,'\0',sizeof(recvBuffer));
AddSocket(socket_set,server_res->socket);
AddSocket(socket_set,server_res->socket);
SetTargetFPS(60);// Set our game to run at 60 frames-per-second