Guys, may someone give me a little example ( using a dos application, since it's simple ) for a server / client?,
and before i forget, a question came across my mind, what if 2 players (clients) send like 4 messages each, at the same time, and the server tried to read the messages, how can it know the order? since it's mixed when the 2 clients sent the messages at once? do the server read and send data to all clients at once? or it sends it to them one by one, each one with different data?
for example..there are 2 players on a server, the first one want's to receive the location and the angles of the second one, and the second one want's the first one's data, how can the server send each one different data? when i use NetSend(), it send data to all clients, right?
EDIT:
//server
#include "stdio.h"
#include "stdlib.h"
#include "multisync.h"
void main ( void )
{
bool host = NetHost ( 10 );
char buff[500];
if ( !host )
{
::NetGetError ( buff, sizeof ( buff ) );
printf ( "%s", buff );
while ( 1 );
}
while ( 1 )
{
if ( ::NetPlayerJoined() )
printf ( "someone joined!\n" );
}
}
//client
#include "stdio.h"
#include "stdlib.h"
#include "multisync.h"
void main ( void )
{
bool connect = NetConnect ( "78.101.21.68" );
char buff[500];
if ( !connect )
{
NetGetError ( buff, sizeof ( buff ) );
printf ( "%s", buff );
while ( 1 );
}
while ( 1 )
{
}
}
is that supposed to work? the client prints TIMED OUT error message