Beefy Boxes and Bandwidth Generously Provided by pair Networks
laziness, impatience, and hubris

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."

Replies are listed 'Best First'.
Re^4: help me on socket programming
by bh_perl (Monk) on Jul 12, 2013 at 09:24 UTC


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

    >telnet 1998 Trying... Connected to 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


    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?

What's my password?
Create A New User
Node Status?
node history
Node Type: note [id://1043906]
Corion idly wonders about creating a series of HTTP requests. There seems to be no framework to generate a series of HTTP requests, like "try all these requests"
[Corion]: This is vaguely inspired by that list of "nasty" strings, which I'd like to replace among HTTP parameters, just to see whether the application crashes, but also for easy downloading of a list of URLs etc
[Corion]: Maybe I'll just conoct something using Algorithm::Permute to create an (OO) generator for such requests, or a simple function.
[Corion]: For testing I imagine one would want to test a random sampling of such "bad"/"unexpected" requests, while for downloading, one would want to generate them all in order, but not necessarily as a huge list

How do I use this? | Other CB clients
Other Users?
Others surveying the Monastery: (8)
As of 2017-01-16 15:40 GMT
Find Nodes?
    Voting Booth?
    Do you watch meteor showers?

    Results (151 votes). Check out past polls.