#1
  1. No Profile Picture
    Contributing User
    Devshed Newbie (0 - 499 posts)

    Join Date
    Nov 2005
    Posts
    64
    Rep Power
    9

    How to sent binary data as request on socket programming


    hi..
    From the data trace packet, i have found the binary data request as below:

    Code:
    ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ARPA/9000 NETWORKING^^^^^^^^^^^^^^^^^^^^^^^^^^@#%
      Timestamp            : Fri Jul 12 PST 2013 15:30:40.370025
      Process ID           : [ICS]              Subsystem        : NS_LS_TCP
      User ID ( UID )      : -1                 Trace Kind       : PDU IN TRACE
      Device ID            : -1                 Path ID          : 0
      Connection ID        : 0
      Location             : 00123
    ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
    -------------------------------- 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 -----------------------------------------
       0: 00 00 02 03 10 01 22 33 20 20 20 20 20 20 20 20  ......"3        
      16: 4a 42 48 42 30 30 32 39 30 30 30 30 30 30 32 30  JBHB002900000020
      32: 30 31 30 30 30 30 30 30 30 30 30 30 33 33 31 36  0100000000003316
      48: 37 36 34 34 31 20 20 20 20 20 20 20 20 20 20 20  76441           
      64: 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20                  
     < printing suppressed for one or more repetitions of the previous line >
     112: 20 20 20 20 20 20 20 20 20 20 30 32 30 37 32 37            020727
     128: 36 33 35 30 37 20 30 32 20 20 20 20 20 20 20 20  63507 02        
     144: 20 20 20 20 20 20 31 33 30 37 31 32 31 34 34 33        1307121443
     160: 33 32 30 30 30 31 31 30 20 20 20 20 20 20 20 20  32000110        
     176: 4a 42 48 42 30 30 30 34 30 30 30 30 30 30 33 30  JBHB000400000030
     192: 30 31 30 30 30 30 30 30 30 30 30 38 39 36 33 32  0100000000089632
     208: 30 30 20 20 20 20 20 20 20 20 20 20 20 20 20 20  00              
     224: 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20                  
     < printing suppressed for one or more repetitions of the previous line >
     272: 20 20 20 20 20 20 20 20 20 20 30 32 30 37 32 37            020727
     288: 36 33 38 30 30 20 30 32 20 20 20 20 20 20 20 20  63800 02        
     304: 20 20 20 20 20 20 31 33 30 37 31 32 31 34 34 34        1307121444
     320: 31 31 30 30 30 30 33 33 20 20 20 20 20 20 20 20  11000033        
     336: 4a 42 48 42 30 30 31 34 30 30 30 30 30 30 32 30  JBHB001400000020
     352: 30 39 30 30 30 30 30 30 30 30 30 35 32 30 37 34  0900000000052074
     368: 34 35 20 20 20 20 20 20 20 20 20 20 20 20 20 20  45              
     384: 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20                  
     < printing suppressed for one or more repetitions of the previous line >
     432: 20 20 20 20 20 20 20 20 20 20 39 39 00 00 00 00            99....
     448: 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00  ................
     < printing suppressed for one or more repetitions of the previous line >
     512: 00 00 00 00 00 00 00 -- -- -- -- -- -- -- -- --  ................
    My problem is how could i write the perl socket programming to sent the binary data as a request into the remote server ?. Could somebody help me ?

    I am very sorry, this is my first experience in socket programming and i very hope somebody can help me..

    Thank you,
  2. #2
  3. No Profile Picture
    Contributing User
    Devshed Novice (500 - 999 posts)

    Join Date
    Jun 2012
    Posts
    776
    Rep Power
    495
    This is cross posted on the Perl Monks forum.
  4. #3
  5. No Profile Picture
    Contributing User
    Devshed Intermediate (1500 - 1999 posts)

    Join Date
    Apr 2009
    Posts
    1,875
    Rep Power
    1225
    Currently, the perlmonks thread only has 1 post which recommends using MIME::Base64 to encode/decode the data, but it doesn't provide any info on the socket coding question.

    I haven't done any socket coding mysqlf, but the starting point would be to look over the following modules.

    Socket - networking constants and support functions
    IO::Socket - Object interface to socket communications
    IO::Socket::INET - Object interface for AF_INET domain sockets

IMN logo majestic logo threadwatch logo seochat tools logo