On 09 Jul 2003 09:09:34 -0700, [EMAIL PROTECTED] (John Tarn) wrote: >i am still a novice in perl so forgive me for this simple question. >what is socket programming? what do sockets do? is there a site >that can explain them to me? thanks
>From a really simple viewpoint, I compare sockets to the concept of "extensions" on the old phone system. When you used to call a pbx system, they would ask, what extension do you want to connect to? A tcp networked computer is similar, it has an IP address (the number), then it has 64000+ extensions(called ports). You can assign programs to "listen to their assigned ports" and do stuff when "packets" (calls) come in. A whole standard has emerged as to what programs are supposeded to listen to what port numbers. http is 80 ..... https is 443 ......smtp is 25......pop3 is 110......ftp is 21 If you are using linux, look at the file /etc/services. You will see all the ports and what is defined for them. Also check out /etc/inetd.conf or /etc/xinetd.conf. Ports are so important, that some general purpose "port daemons" have been written, to make port programming easier. They are called inetd and xinetd. They handle alot of the socket details, and you can write socket programs to use them, or be independent. Now computer ports are much more complicated than what I described above. There are tcp and udp protocols for each port, and the simplest way to describe sockets is a "filehandle to a port". Just like you open a filehandle to read and write to a file, you open a socket to read and write to a port. Socket programming allows programs to open ports to talk to one another, sometimes the programs can be on the same machine, where sockets are a convenient way to do inter-process communication. Sometimes the programs are on different machines, where it is networking, over the internet for example. -- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]