On 04/24/2013 10:21 PM, silvioprog wrote: > 2013/4/24 silvioprog <silviop...@gmail.com <mailto:silviop...@gmail.com>> > > Hello, > > There are a multi-thread example using SSockets in FPC? > > I'm trying to implement it*, but it's very hard and this work it's > consuming all my time. The difficulty is to read and write at the > same time. I'm almost certain that using SSockets, I would have to > create one socket for writing and one for reading, separately by > threads. > > Thank you! > > * https://bitbucket.org/silvioprog/tcpipcomp (this repo is > temporary, and this all code can undergo drastic changes at any time) > > > ... like ScktComp of Delphi. (no Synapse, LNet or Indy please, I need to > use native code) >
what is the problem with using Synapse, LNet or Indy? Seen the questions you are asking I would suggest you use an existing library and stay away from writing your own socket library or start with learning the basics of socket programming. SOCK_STREAM sockets are full duplex and you can read and write simultaneously on them, even without threading if you use non blocking mode. SSocket has a Property NonBlocking but I don't see any code that handles the EAGAIN or EWOULDBLOCK errors. That is probably left to the user of TSocketStream to deal with. So SSocket is a really thin layer that leaves the user with all the problems you are trying to solve. Ludo _______________________________________________ fpc-pascal maillist - fpc-pascal@lists.freepascal.org http://lists.freepascal.org/mailman/listinfo/fpc-pascal