Guidance
指路人
g.yi.org
Guidance Forums / wxWidgets (wxWindows) in C++ / Sockets Message size > 255 characters

Register 
注册
Search 搜索
首页 
Home Home
Software
Upload

  
Forum List • Thread List • Reply • Refresh • New Topic • Search • Previous • Next First 1 Last
Message1. Sockets Message size > 255 characters
#2594
Posted by: 2003-09-03 23:45:50
Hello
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
#2595
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
#2596
Posted by: guidance 2003-09-04 09:15:56
I think so.

From the doc:

wxSocketBase& Write(const void * buffer, wxUint32 nbytes)

http://g.yi.org/_scripts/file.php?f=8984&r=401#wxsocketbasewrite
Forum List • Thread List • Reply • Refresh • New Topic • Search • Previous • Next First 1 Last
掌柜推荐
 
 
 
 
 
 
 
 
 
 
 
 
© Sun 2022-12-4  Guidance Laboratory Inc.
Email:webmaster1g.yi.org Hits:0