Danke mr.smith du meinst bestimmt das hier wen ich mich nicht irre?
doch irgendwie kriege ich das nicht verbindet könntest du mir ein Beispiel dafür machen ?
Hier mal meine jetzige While schleife:
Code:
While(true)
{
memset(&sendbuf, 0, sizeof(sendbuf));
Client = accept(slisten,(struct sockaddr*)&Clientinfo,&Clientinfolen);
if(Client != SOCKET_ERROR)
cout << "Client accepted: " << inet_ntoa(Clientinfo.sin_addr) <<" On Port: "
<< ntohs(Clientinfo.sin_port) << endl;
res = send(Client, "Welcome in Newtwork",strlen("Succesfull connected to Server!"),0);
if( res != SOCKET_ERROR )
cout << "Message Succesfull sendet to Client: " << inet_ntoa(Clientinfo.sin_addr) <<" On Port: "
<< ntohs(Clientinfo.sin_port) << endl;
else
cout << "Failed to send Message Reason:" << WSAGetLastError <<endl;
cin.getline(sendbuf,256);
res = send(Client, sendbuf ,strlen("Succesfull connected to Server!"),0);
if( res != SOCKET_ERROR )
cout << "Message Succesfull sendet to Client: " << inet_ntoa(Clientinfo.sin_addr) <<" On Port: "
<< ntohs(Clientinfo.sin_port) << endl;
else
cout << "Failed to send Message Reason:" << WSAGetLastError <<endl;
for(int i=0; i < MAX_CLIENTS; i++)
{
if( CLIENT_HANDLE[i] != 0 )
{
cout << "Clienthandle "<< i << ": " <<CLIENT_HANDLE[i] << endl;
}
}
}