Advertisement

Unix Internet programs

Started by February 04, 2003 11:54 AM
5 comments, last by Xgkkp 21 years, 7 months ago
..for want of a better title. I just want to be able to do some communications stuff with unix, like writing a simple irc client or something. the language would probably be c, or perl. The problem is, I can''t seem to find any resources on this on unix - just lots of stuff on winsock. can anyone help?
The unix sockets FAQ: http://www.developerweb.net/sock-faq/ has lots of info.
The late W. Richard Stevens (preserved) homepage: http://www.kohala.com/start/ (Stevens was the author of "Unix Network Programming" (vol 1-2), still the major reference on the topic, and a bunch of other related books)

hth

(My projects and ramblings...)
Advertisement
Winsock is the result of microsoft embracing and extending sockets... If you cut the fat that''s sitting on it, its very much like regular sockets.

i.e. connect() write() read() (oh wait... windows bastardized it into send and recv didnt it) close() gethostfromname() HOSTENT

etc...
IIRC, the ironic thing is that sockets was invented at Berkley for BSD systems

Maybe a search on Unix sockets would be helpful
The world has achieved brilliance without wisdom, power without conscience. Ours is a world of nuclear giants and ethical infants. We know more about war than we know about peace, more about killing than we know about living. We have grasped the mystery of the atom and rejected the Sermon on the Mount." - General Omar Bradley
It''s should be fairly easy as most docs and tuts out there are conserned about Berkley Sockets. If you want to code something (preferable a client) in Perl, look here: http://www.perldoc.com/perl5.6/pod/perlipc.html#Sockets--Client-Server-Communication

If you still haven''t gotten anything the following page has a bunch of C source
involving various TCP and UDP codes

http://www.linuxsocket.org/books/Sockets/programs/

I would also suggest just doing a man on gethostbyname, socket, bind, sendto, recvfrom and any of the suggested additionals at the bottom of each of those pages. Additionally the rfc that describes the various packets that are going to be used and how they are shaped will probably be invaluable.

Hope this helps.
They that can give up essential liberty to obtain a little temporary safety deserve neither liberty nor safety. -- Benjamin Franklin, Historical Review of Pennsylvania, 1759
Advertisement
If you''re still interested =)

There are plenty of ways to do sockets with Perl or Python, especially if it''s something you want to do as a quickshot or as a learning excercise. (you can modify it without recompile which is nice.)

I would recommend Python, it''s still very close to C structured program.

http://www.python.org/doc/current/lib/module-socket.html

Perl has its sockets as well:

http://www.perldoc.com/perl5.6/pod/perlipc.html#Sockets--Client-Server-Communication

Another great aspect to using these languages for this sort of work is they are cross platform (so long as Perl or Python interpreters are installed).

I''ve personally become more enamored of Python lately. What they say is true, I spend less time fighting the syntax of the language than I do with Perl or other script languages (including WSH-VBScript, etc). I also find their C extend and embed features much cleaner than Perl''s if you''re into that sort of thing.

The ActiveState Python distribution even has an API for some key parts of the Win32 API meaning you can write scripts to call functions such as EnumWindows() and such just as if you would write a full program. It''s nice when you want to test an algorithm or just write some quick shot program.

http://www.activestate.com/Products/ActivePython/

Interim

This topic is closed to new replies.

Advertisement