Sign in Join

Live chat for Free Pascal, Lazarus, Delphi and every Pascal programmer.

Mailing lists / fpc-devel / 2006-05

Unix sockets for Windows

3 messages · 3 people ·

Reply by email Subscribe to this list Your subscription

Read-only archive. Use j and k to move between messages.

Alexander Todorov

Hello,
I have an application that uses TCP sockets nut it is going to be changed with UNIX sockets.
Can you point me to some easy and clean approach how to emulate UNIX sockets for Windows.
The only thing I can think of is using named pipes and encapsulate the functionality in some class. Any other alternative are welcome.

Thanks.

Reply by email

Ales Katona
to Alexander Todorov
Alexander Todorov wrote 13 lines
Hello, I have an application that uses TCP sockets nut it is going to be changed with UNIX sockets. Can you point me to some easy and clean approach how to emulate UNIX sockets for Windows. The only thing I can think of is using named pipes and encapsulate the functionality in some class. Any other alternative are welcome. Thanks. _______________________________________________ fpc-devel maillist - http://lists.freepascal.org/mailman/listinfo/fpc-devel

You could use lNet. It's an asynchronic non-blocking, single-threaded OOP net lib for FPC. You can find it at http://members.chello.sk/ales (svn version is in fpcprojects branch on FPC svn).

If nothing else, you can see how I abstracted socket calls to get both windows and unix working.

Ales

P.S: look in lnet.pas and lcommon.pas. The second one abstracts calls like select and FD_SET stuff. The first one has some ifdefs on "recv" and "send".

Reply by email

Michael Van Canneyt
to Alexander Todorov: I have an application that uses TCP sockets nut it is going to be changed with UNIX…
Alexander Todorov wrote 7 lines
Hello, I have an application that uses TCP sockets nut it is going to be changed with UNIX sockets. Can you point me to some easy and clean approach how to emulate UNIX sockets for Windows. The only thing I can think of is using named pipes and encapsulate the functionality in some class. Any other alternative are welcome.

What cygwin does is allocate a free TCP port and write the port parameters in the "unix" socket file. You could try to emulate it like that. I would be interested in seeing such an emulation.

Named pipes don't support several distinct clients, AFAIK.

Michael.

Reply by email