Getting Local Port Number in Perl

Collapse
X
 
  • Time
  • Show
Clear All
new posts

  • darksteel21
    replied
    thanks for these information, i'll study these methods...

    Leave a comment:


  • RRick
    replied
    You are almost there, the following methods will supply the info you need.

    The following methods can be used on socket filehandle objects created by IO::Socket::INE T:

    * sockaddr
    * sockport
    * sockhost
    * peeraddr
    * peerport
    * peerhost

    For more info try http://docstore.mik.ua/orelly/perl/perlnut/ch13_02.htm

    Leave a comment:


  • darksteel21
    replied
    i am using these codes :
    Code:
    $r_socket = IO::Socket::INET->new(PeerAddr => $ServerIP,PeerPort => $ServerPort,Proto => 'tcp') or die("Socket Error Connection");
    I am using the IO:Socket module
    Last edited by eWish; Apr 27 '09, 10:05 PM. Reason: Please use the code tags

    Leave a comment:


  • Icecrack
    replied
    how are you calling your socket

    have you tried?

    socketpair(DOMA IN, TYPE, PROTOCOL)

    Leave a comment:


  • darksteel21
    replied
    I am trying to get the client to send its port to the server for authentication. ..
    my perl script resides on the client..

    Leave a comment:


  • Icecrack
    replied
    Let me clear up on this, you are trying to get the client to send its port to the server for auth?

    or are you trying just to find out what port the client is running on?

    Leave a comment:


  • darksteel21
    started a topic Getting Local Port Number in Perl

    Getting Local Port Number in Perl

    Hi to all,

    I am currently developing an application in perl that is capable of connecting to a server and sends information..
    the server has a deamon that listens to the socket connections. It requires a socket port number of the client used in making a socket connection for validation..

    is there a way in perl in which i can get the local port number (client side) used in making a socket connection to the server?(using Socket and IO:Socket libraries only)

    Regards,
    Mark Tan
Working...