[Gambas-user] Socket Limitations

Benoît Minisini gambas at ...1...
Sun Jan 3 13:20:44 CET 2010


> [lot of talk]

The point of view of the client and the server are not the same:

The client likes blocking socket. It usually asks or sends something to the 
server, waits for the answer, and so on... It usually does one thing at once.

On the contrary, the server should serve multiple client connection at once. 
Then it should use non-blocking sockets, and send data to the client only when 
the socket raises its Write event, meaning that the OS has told Gambas that 
the internal socket write buffer has space in it.

The timeout is managed by the OS: I can only offer a property to define it, as 
in other languages, but that should change nothing to the logic of the 
program.

<Kadaicha irony mode>

I'm not sure that the MSDN documentation is a good reference for socket 
programming:

- The Microsoft documentation is often not connected to the reality it tries 
to describe.

- The Windows socket implementation often behaves differently than the other 
OS implementation.

</Kadaicha irony mode>

My problem is: how can I have the easier Socket interface in Gambas for all 
possible socket scenarii?

That is the reason why I said that if the user asks for writing a big chunk of 
data to the socket, I should temporarily other blocking mode. Maybe he is 
doing something wrong (i.e. using a non-blocking socket, but not the Write 
event), but Gambas can't be sure.

Gambas 2 behave this way (not my decision), and I removed this behaviour in 
Gambas 3, but now I don't remember why. I should test all the scenarii...

Regards,

-- 
Benoît Minisini




More information about the User mailing list