Beefy Boxes and Bandwidth Generously Provided by pair Networks
Just another Perl shrine
 
PerlMonks  

Re^3: help me on socket programming

by Utilitarian (Vicar)
on Jul 12, 2013 at 08:37 UTC ( #1043906=note: print w/ replies, xml ) Need Help??


in reply to Re^2: help me on socket programming
in thread help me on socket programming

To expand what NetWallh said, when you telnet to port 1998 with the command below, does it send a response, or do you need to send a request in order to get a response?

telnet $SWITCH_ADDRESS 1998

print "Good ",qw(night morning afternoon evening)[(localtime)[2]/6]," fellow monks."


Comment on Re^3: help me on socket programming
Select or Download Code
Re^4: help me on socket programming
by bh_perl (Monk) on Jul 12, 2013 at 09:24 UTC

    hi...

    I have tried run the command as below and its look hang.

    >telnet 19.25.15.15 1998 Trying... Connected to 19.25.15.15. Escape character is '^]'.

    I think this is the system scenario to do the data collection

    1. Sent request to the remote server with specific address.

    2. Remote server acknowledge with some info.

    3. Collect available data based on the information and save into temporary file.

    4. End connection

      There does not appear to be a stream of data to read coming from that port when you connected, usually you have to send a request in these circumstances and the response is then sent and the socket is closed by the remote host or an agreed end of data signal flag is sent (usually "OK" or ("NO"|"KO")) to indicate the end of the data stream.

      In this case you should perhaps print your request to the socket and process the data stream until end of data or end of response token.

      print "Good ",qw(night morning afternoon evening)[(localtime)[2]/6]," fellow monks."
Re^4: help me on socket programming
by bh_perl (Monk) on Jul 13, 2013 at 03:17 UTC

    hi...


    Based on the trace packet, I found that my server using port 1998 and the remote server using port 61236.

    How could i write the socket program to connect from my port (1998) to remote system on port (61236).

    This is sample data trace:

    Sent request to remote system
    -------------------------------- TCP Header -------------------------- +-------- sport: 1998 --> dport: 61236 flags: PUSH ACK seq: 0xfd2fed0a urp: 0x0 chksum: 0xe16a data len: 519 ack: 0x2f975faf win: 0x1ed9 optlen: 0 -------------------------------- XOT --------------------------------- +--------

    Remote server acknowlegde
    -------------------------------- TCP Header -------------------------- +-------- sport: 61236 --> dport: 1998 flags: PUSH ACK seq: 0x2f975faf urp: 0x0 chksum: 0x1b data len: 7 ack: 0xfd2fef11 win: 0x8000 optlen: 0 -------------------------------- XOT --------------------------------- +-------- 0: 00 00 00 03 10 01 41 -- -- -- -- -- -- -- -- -- ......A........ +.

Log In?
Username:
Password:

What's my password?
Create A New User
Node Status?
node history
Node Type: note [id://1043906]
help
Chatterbox?
and the web crawler heard nothing...

How do I use this? | Other CB clients
Other Users?
Others taking refuge in the Monastery: (8)
As of 2014-12-19 22:59 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    Is guessing a good strategy for surviving in the IT business?





    Results (94 votes), past polls