Results 1 to 4 of 4

Thread: Get client ip adress or pc name with winsock?

  1. #1

    Thread Starter
    Member
    Join Date
    May 2006
    Posts
    60

    Get client ip adress or pc name with winsock?

    hi, i have a question

    I am also using winsock to send some text to a server, but is it possible
    that i can send the ip from the client to the server.
    What i want to do is, that when the server gets that ip, he will automatically connect to that client.

    greetz Neophyte

    ok i tried to get it with this code what i placed in the server form:

    VB Code:
    1. Dim Received As String
    2.  
    3. winsock1.GetData Received
    4. fs = Left(Received, 1)
    5. If fs = "E" Then
    6. fs2 = Right(Received, Len(Received) - 1)
    7. client.winsock1.remotehost = fs2
    8. client.winsock1.remoteport = 88
    9. client.winsock1.connect

    this did not work :S
    Last edited by Neophyte|NL; May 18th, 2006 at 01:14 PM.

  2. #2
    New Member
    Join Date
    Feb 2006
    Posts
    5

    Re: Get client ip adress or pc name with winsock?

    there is no need for the server to make a new connection. you could not use the same winsock1 controle aneyway without closing the old connection. the server is alredy connected and is able to reply once the client is connected. (it is connected if it can send a string to the server). look up somthing like "vb6 simple chat" on google.
    i appoligise for my spelling

  3. #3

    Thread Starter
    Member
    Join Date
    May 2006
    Posts
    60

    Re: Get client ip adress or pc name with winsock?

    no problem for spelling..

    i figured something out with the code i wrote above.
    But it wil have the code in the textbox and i do not want that.

    but thanks for reply i will search on google.

    thanks

  4. #4
    Hyperactive Member
    Join Date
    Jan 2006
    Location
    Pakistan
    Posts
    388

    Re: Get client ip adress or pc name with winsock?

    The problem shuold be pretty simple.
    First of all you need to have an unused socket.
    Now when you connect the client to the server (since n networking its always the client that requests) automatically its IP will go to the server and will be usable in the ConnectionRequest sub and the IP will be in RequestID

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