Re: WinSock
By: Jon Justvig to Digital Man on Tue Jun 12 2018 04:34 pm
> Re: WinSock
> By: Digital Man to Jon Justvig on Tue Jun 12 2018 11:32 am
>
> >> Okay, I figured out send() just fine. I'm having major issues with
> >> recv(). Right now, I can only get it to input one character, even with
> >> char arrays or strings. Here's a sample:
>
> char buffer[20];
>
> >> int result;
>
> >> // our recv loop
> >> while (true)
> >> {
>
> >> result = recv(current_client, buffer, sizeof(buffer), 0); // recv cmds
>
> >> Sleep(10);
>
> >> if (result > 0)
> >> {
> >> cout << "\n\tMessage from client: " << buffer;
> >> send(current_client, (const char*)buffer, sizeof(buffer), 0);
> >> }
>
> just above int result; ...
So.. if you only receive 2 bytes (result == 2), you're still going to send 20
(sizeof buffer)? That's probably not what you want.
digital man
This Is Spinal Tap quote #16:
David St. Hubbins: I believe virtually everything I read...
Norco, CA WX: 83.2°F, 43.0% humidity, 9 mph ENE wind, 0.00 inches rain/24hrs
---
■ Synchronet ■ Vertrauen ■ Home of Synchronet ■ [vert/cvs/bbs].synchro.net
|