Results 1 to 2 of 2

Thread: Capturing data in Socket Programming

  1. #1

    Thread Starter
    Member
    Join Date
    Mar 2004
    Posts
    39

    Capturing data in Socket Programming

    I am testing a cleint/server system writen in VB.Net 2005 using asynchronous connections and I discovered that with Net 2.0 I can use the Config.exe.ini file to capture data. The data captured includes detailed information but I cannot find a way to discover the client IP. A sample of the data is as follows:-

    System.Net.Sockets Verbose: 0 : [0740] Socket#30015890::BeginAccept()
    System.Net.Sockets Verbose: 0 : [0740] Exiting Socket#30015890::BeginAccept() -> AcceptAsyncResult#1707556

    Can anybody advise whether the Socket# can somehow lead me to the details of the Client connection, ex IP/Port.

    Thanks

  2. #2
    Hyperactive Member
    Join Date
    Feb 2001
    Location
    Houston, TX
    Posts
    342

    Re: Capturing data in Socket Programming

    I don't know how that config file stores its ports but the IP address is in long format. I'm sure there are simpler ways of breaking this down but I just do the math to reverse it back to IP address.

    VB Code:
    1. Dim LongIPAddress As Long = 30015890
    2.  
    3.         Dim num As Integer
    4.         Dim sIP(4) As String
    5.  
    6.         For i As Integer = 1 To 4
    7.  
    8.             num = Int(LongIPAddress / 256 ^ (4 - i))
    9.             LongIPAddress = LongIPAddress - (num * 256 ^ (4 - i))
    10.  
    11.  
    12.             sIP(4 - i) = num & "."
    13.  
    14.         Next
    15.  
    16.         Dim IPAddress As String = String.Concat(sIP)
    17.         IPAddress = IPAddress.TrimEnd(".")

    HTH

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  



Click Here to Expand Forum to Full Width