Sign in Join

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

Mailing lists / fpc-devel / 2006-01

using sockets on linux and win32

4 messages · 3 people ·

Reply by email Subscribe to this list Your subscription

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

Stefan Kisdaroczi

Hi,

im trying to use sockets in a unit which should work on linux and win32.

I use the sockets unit, but for things like SOL_SOCKET, TTimeval (for setsockopt), SO_RCVTIMEO, fpgeterrno I finally had to use unix,unixtype,baseunix. This on Linux.

Now I try to compile it on windows:
It seems I need SocketError and not fpgeterrno ( there is a thread about that some days old ). But where do I find SOL_SOCKET for windows? using winsock did not help. I searched for a good example using google, searched the fpc docs... there seems to be a lot of outdated information.

And now the question:
Has someone an "uses"-clause compatible with linux and windows for an app really using sockets and not only for a simple "hello socket"?

thank you
kisda

Reply by email

Ales Katona
to Stefan Kisdaroczi
Stefan Kisdaroczi wrote 24 lines
Hi, im trying to use sockets in a unit which should work on linux and win32. I use the sockets unit, but for things like SOL_SOCKET, TTimeval (for setsockopt), SO_RCVTIMEO, fpgeterrno I finally had to use unix,unixtype,baseunix. This on Linux. Now I try to compile it on windows: It seems I need SocketError and not fpgeterrno ( there is a thread about that some days old ). But where do I find SOL_SOCKET for windows? using winsock did not help. I searched for a good example using google, searched the fpc docs... there seems to be a lot of outdated information. And now the question: Has someone an "uses"-clause compatible with linux and windows for an app really using sockets and not only for a simple "hello socket"? thank you kisda _______________________________________________ fpc-devel maillist - http://lists.freepascal.org/mailman/listinfo/fpc-devel

Hello, you need to use WinSock in windows and get error with WSAGetError (IIRC) function from the winsock unit. Note that the winsock unit in FFC RTL is winsock1 (deprecated, obsolete). I'd strongly advise for a Winsock2 unit (there are some flying around in the net).

Also not ment as an advertisment but I've made a networking library which works cross platform on windows and unix including PPC platform. You can get it at http://members.chello.sk/ales
If nothing else you can view the source and see how I coped with cross-platform networking problems.

Ales

Reply by email

Stefan Kisdaroczi
to Ales Katona
Ales Katona wrote 42 lines
Stefan Kisdaroczi wrote: > Hi, > > im trying to use sockets in a unit which should work on linux and win32. > > I use the sockets unit, but for things like SOL_SOCKET, TTimeval (for > setsockopt), SO_RCVTIMEO, fpgeterrno > I finally had to use unix,unixtype,baseunix. This on Linux. > > Now I try to compile it on windows: > It seems I need SocketError and not fpgeterrno ( there is a thread > about that some days old ). > But where do I find SOL_SOCKET for windows? using winsock did not help. > I searched for a good example using google, searched the fpc docs... > there seems to be a lot of outdated information. > > And now the question: > Has someone an "uses"-clause compatible with linux and windows for an > app really using sockets and not only for a simple "hello socket"? > > thank you > kisda > > _______________________________________________ > fpc-devel maillist - > http://lists.freepascal.org/mailman/listinfo/fpc-devel > > > Hello, you need to use WinSock in windows and get error with WSAGetError (IIRC) function from the winsock unit. Note that the winsock unit in FFC RTL is winsock1 (deprecated, obsolete). I'd strongly advise for a Winsock2 unit (there are some flying around in the net). Also not ment as an advertisment but I've made a networking library which works cross platform on windows and unix including PPC platform. You can get it at http://members.chello.sk/ales If nothing else you can view the source and see how I coped with cross-platform networking problems. Ales

Thanks for your quick reply. I downloaded your lnet-sources and will Impression: The fpc-sockets seems far away from a cross-platform solution. :-(

kisda

Reply by email

Tony Maro
to Stefan Kisdaroczi: im trying to use sockets in a unit which should work on linux and win32. I use the…
Stefan Kisdaroczi wrote 17 lines
Hi, im trying to use sockets in a unit which should work on linux and win32. I use the sockets unit, but for things like SOL_SOCKET, TTimeval (for setsockopt), SO_RCVTIMEO, fpgeterrno I finally had to use unix,unixtype,baseunix. This on Linux. Now I try to compile it on windows: It seems I need SocketError and not fpgeterrno ( there is a thread about that some days old ). But where do I find SOL_SOCKET for windows? using winsock did not help. I searched for a good example using google, searched the fpc docs... there seems to be a lot of outdated information. And now the question: Has someone an "uses"-clause compatible with linux and windows for an app really using sockets and not only for a simple "hello socket"? thank you kisda

I'd recommend Synapse tools. They're blocking only, but I have used them extensively. They even support HTTP file transfers and SSL.

But, I'm not too up on what the latest sockets development in FPC has been, perhaps there's something better now.

-Tony

Reply by email