Guidance Forums / wxWidgets (wxWindows) in C++ / Sockets Message size > 255 characters

Search 搜索
Home Home

Forum List • Thread List • Refresh • New Topic • Search • Previous • Next First 1 Last
Message1. Sockets Message size > 255 characters
Posted by: 2003-09-03 23:45:50
I am using sockets in my application that consists of one server and one client. The client just sends one word (a keyword in fact) and the server replies with a lot of data. The problem is when this reply is > 255 char., the message is truncated. It does not occurs with the client of course but sometimes with the server. Its function to send data is:

  wxString message = ("here I write something");
  buf = ((char *) message.GetData());  
  unsigned char len  = (wxStrlen(buf) + 1) * sizeof(wxChar);
  sock->Write(buf, len);

So what's missing to allow the sending of more than 255 char. ?

thanks for your help !
Message2. Re: Sockets Message size > 255 characters
Posted by: 2003-09-04 00:15:46
I found why, it is because len is of type char and can therefore not be > 255.... But I don't understand, I think it was like that in the sockets sample, it's not so nice huh?
Message3. Re: Sockets Message size > 255 characters
Posted by: guidance 2003-09-04 09:15:56
I think so.

From the doc:

wxSocketBase& Write(const void * buffer, wxUint32 nbytes)
Forum List • Thread List • Refresh • New Topic • Search • Previous • Next First 1 Last
© Tue 2024-7-23  Guidance Laboratory Inc. Hits:0