unsigned short Port=4567;
DoClientUDP(hWnd,Port);
void DoClientUDP(HWND hwnd,unsigned short Port)
{
sf::IPAddress ServerAddress;
ServerAddress=sf::IPAddress::LocalHost;
while (!ServerAddress.IsValid());
sf::SocketUDP Client;
unsigned short CPort=4323;
Client.Bind(CPort);
char Message[3] = "Hi";
if (Client.Send(Message, sizeof(Message),ServerAddress, Port) != sf::Socket::Done)
return;
else
{
DoServerUDP(hwnd);
Client.Close();
}
}
void DoServerUDP(HWND hwnd)
{
unsigned short Port=4567;
sf::SocketUDP Server;
char Buffer[200]="";
std::size_t Received;
sf::IPAddress ClientAddress=sf::IPAddress::LocalHost;
unsigned short ClientPort;
char Message[3]="";
if (!Server.Bind(Port))
return;
Server.SetBlocking(false);
sf::Socket::Status SocketStatus=sf::Socket::Done;
SocketStatus=(Server.Receive(Message, sizeof(Message), Received, ClientAddress, ClientPort));
Server.Close();
}
This is my code. Now when i execute the statement(Server.Receive), the SocketStatus becomes NotReady.The client sends the message but the server does not receive it.What should be done???Please HELP!!!