Socket trouble on OSX


photo

Recommended Posts

Hi,

 

I am working with Unigine Socket and I have some trouble on OSX. I don't think it's a bug, seems more like a limitation from the OS.
I have a script class http. This class can make GET / POST / POST MULTIPART / POST FILE and it's working well, ... at least for windows. 
Our software do some request on php file on our server for upload some screenshot in zip format (500 Ko). The trouble is on windows the upload work, but on OSX everything seems good, the socket it's writing the good size, but after using writeStream, theorically we must be receive a response from the server, and nothing .... Seems like a limitation but I don't yet find where.

May be someone on the forum, have bigger expertise in network and can advice me about may be a limitation on OSX socket or other, I will try to use WireShark for see if I can have more info ... 

Thanks 

 

Tony

Link to post

Hi have more details about my trouble when I change my code,  It's seems related to writeStream, if I change my code using writeChar it's working .... BTW the value return by writeStream it's correct on OS X, also writeStream work sometimes on request more light.


  // WORKING ON OSX

  for (int i = 0 ; i < requestBuffer.getSize(); i++) {
    socket.writeChar(requestBuffer.readChar());
  }


  // NOT WORKING ON OSX

  socket.writeStream(requestBuffer,requestBuffer.getSize());
Link to post
  • 2 weeks later...

Hi Unclebob, I already play with send, 

I try with a max buffer size and call socket.writeStream inside a loop writing the same block size.

I also try to set the send value with the size of what I want send : send(requestBuffer.getSize());
 

Unfortuantely no result for now :(

Link to post

Hello again, Anthony!

I think the OS itself may limit send/recv buffer size. I've found pretty interesting topic about this: http://stackoverflow.com/questions/10063497/why-changing-value-of-so-rcvbuf-doesnt-work/10063799#10063799

In short, try to change your buffser size values right in the OS settings.

For recv buffer you can find them there:

proc/sys/net/core/rmem_default
proc/sys/net/core/rmem_max

Link to post

Also, if it's not acceptable for you, then I suggest you to split your data to several packets.

Link to post