Listening on port for incoming data?

I am not what I would call an experienced programmer.
I know some ksh etc..

I need to be able to listening on a port for incoming data on a ultra 10 using solaris 9. Basically all that I need to do at the moment is to log the incoming data on a specific port number.

Any ideas on how I can get started on this?

what language do you want to do this in? this page: Programming in C has an introduction to socket programming in C.

Hi,

I have never really learned much in C...

Could it be do in korn shell scripting or perl or something??

any help would be great. Thanks

I don't think socket programming is supported in any shell scripting. Perl does, though. It's not a shell scripting language anyway. Unless you choose to use the IO::Socket module, Perl's socket programming is (nearly) identical to that of C. So any socket programming literature in C is likely to help you.

[P.S. I'm currently writing a doc with a section on Perl network programming. It's not complete but has at least a TCP/UDP server/client simple example with some explanations. If you need to I can extract that part from the PDF and send it to you.]

yes, in a shell script you would have to use some outside utility to do any type of networking. so, you could search on freshmeat.net or a similir site (like sourceforge) for some type of small utility that can establish connections with hosts, and send and recieve data.

Python also has some builtins for easy socket manipulation.

Cheers,

Keith

In Java you would do something like this:

public class HTTPServer { 
  public static void main(String a[]) throws Exception { 
  final int httpd = 80; 

  ServerSocket ssock = new ServerSocket(httpd); 
  System.out.println("have opened port 80 locally"); 

  Socket sock = ssock.accept(); 
  System.out.println("client has made socket connection"); 

  OneConnection client = new OneConnection(sock); 
  String s = client.getRequest(); 
  } 
}