Results 1 to 3 of 3

Thread: Winsock, socks proxy servers, a real problem :(

  1. #1

    Thread Starter
    New Member
    Join Date
    Jul 2001
    Location
    UK
    Posts
    2

    Lightbulb Winsock, socks proxy servers, a real problem :(

    Hello there.

    I am having REAL trouble connectling through a socks 4 proxy server using winsock. I have read the RFC @ http://www.socks.nec.com/protocol/socks4.protocol and from what I can see with my code I have made no errors. But when I connect to the proxy server (I should get a response back when I send the data) and send the data telling it to connect to the remote PC, I get nothing. I send the data "14230062.112.202.23" and I have even tried "14230062.112.202.23MeNULL", no change. Here is the whole lot of code I have (very basic, its just to test it):

    Private Sub Command1_Click()
    Winsock1.Connect "90.0.0.1", 1080

    Do Until Winsock1.State = sckConnected
    DoEvents: DoEvents: DoEvents: DoEvents
    If Winsock1.State = sckError Then
    MsgBox "Problem connecting!"
    Exit Sub
    End If
    Loop

    Winsock1.SendData "14230062.112.202.23" '(or "14230062.112.202.23MeNULL"
    End Sub


    Private Sub Winsock1_DataArrival(ByVal bytesTotal As Long)
    Dim strData As String
    Winsock1.GetData strData
    MsgBox strData
    End Sub

    I hope someone who may understand the RFC better than me an tell me where I am going wrong.

    Thanks for reading this rather long winded problem

    Will (aka Degu)

  2. #2
    Addicted Member csammis's Avatar
    Join Date
    Mar 2001
    Location
    /dev/null
    Posts
    226
    I don't know beans about Socks4, but I'm going to give some advice that I've given with socket programming in the past

    Don't use that DoEvents loop. Wait for the "Connect" event to fire to send your string. The point of the Winsock control, VB, and even Windows is event driven programming. I've seen cases where the string being sent is okay, but the connection/sending code is screwing up. Like I said, never tried Socks4, but cleaning up the code may help!
    Things I've Said:
    "Life's funny like that...elephants can wear frilly lace panties, and Dubya still looks like a monkey in a big chair"
    "Take four goats and strap one to each foot of a llama. Presto, goat-powered llama!"
    "You want to get me to work more, get me a Coke. No? Then deal with inferior garbage, I'm not coding another line and your clients can go to......thanks, I'd love a Coke right about now!"

  3. #3

    Thread Starter
    New Member
    Join Date
    Jul 2001
    Location
    UK
    Posts
    2

    Smile Thanks :)

    Thanks very much

    I'm now useing that event in my program, no change to the result when conencting to the proxy server, but it looks a little neater.

    Thanks again.

    Degu

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