Basically, I've decided to mess around with sockets and create a telnet style IRC client. However, I am having a problem with the program getting the chat from the server channel and simultaneously letting me enter chat to be sent. I've tried a few various ways on how to do this but they all either ended up getting the buffer and not letting me chat or letting me chat and not getting the buffer. The way that I am doing it so far is
Code:
while(true)
{
while((recv(Socket, buffer, strlen(buffer), 0) != 0) ||
(recv(Socket, buffer, strlen(buffer), 0) != -1))
{
cout<<buffer;
break;
}
memset(buffer, 0, strlen(buffer));
cin>>cintext;
strcpy(texttosend, "PRIVMSG #blahhh :");
strcat(texttosend, cintext);
strcat(texttosend, "\r\n");
send(Socket, texttosend, strlen(texttosend), 0);
memset(cintext, 0, 255); memset(texttosend, 0, 255);
}
but it's not really letting me enter text/read simultaneously. I can't really logically think of how this would be implemented after trying tons of different approaches, if someone can help me out of this it would be greatly appreciated. Thanks.