These are my initializations, assume all is correct with connecting to windows etc... i want to recieve data form the client on the socket "incoming" and i want to send information to the client on socket "outgoing"
these are some form of my initializations, assume all is correct
int incoming = socket(AF_INET, SOCK_DGRAM, 0);
int outgoing = socket(AF_INET, SOCK_DGRAM, 0);
sockaddr_in & server;
sockaddr_in & client;
assignserver(server) ; //this function assigns IP and port to my station (server)
assignserver(client) ; //this function assigns IP and port to my station (server)
bindfunction(incoming,server) // this binds server(me) to socket incoming
here is the psuedocode of what i want to do ... how can i do it?
while(true)
{
if(recieve anything on socket incoming)
{
process information;
}
else // nothing is recived
{
output some data to client on the outgoing socket;
}
}
so what i want to do is keep sending data on the outgoing socket forever and ever. when i recieve data on the incoming socket, i want to stop sending on the outgoing socket and process the information i recieve on the incoming socket..
i have tried WSANETWORKEVENTS.. which didnt work out very well since i couldnt find proper sources.. can someone please give me proper code or link.. where i can see what i want to do in action so i can understand and do the same...
thanks