Section One BBS

Welcome, Guest.


Subject: WinSock Date: Wed Jun 13 2018 04:29 am
From: Jon Justvig To: Digital Man

  Re: WinSock
  By: Digital Man to Jon Justvig on Tue Jun 12 2018 05:29 pm

 >> 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; ...

 DM> So.. if you only receive 2 bytes (result == 2), you're still going to send
 DM> 20 (sizeof buffer)? That's probably not what you want.

How might I receive between 2 and 12 bytes?

Sincerely,
Jon Justvig
Stepping Stone BBS
telnet://vintagebbsing.com:2325
http://vintagebbsing.com:81

---
 ■ Synchronet ■ Stepping Stone BBS - vintagebbsing.com:2325

Previous Message       Next Message
In Reply To: WinSock (Digital Man)
Replies: WinSock (Digital Man)