Jump to content
Xtreme .Net Talk

Recommended Posts

Posted

Ok...here's what I'm trying to do...

 

I'm trying to write a SOCKS4-type proxy with a console interface to display status information. (e.g. I would type connections at the prompt and get a list of connected clients). I've never written a network application before, but the logic seems simple enough. I found some sample code that listens for a TCP connection. The first packet I get from the client is to negotiate a connection. I get the target IP address and port number from the client.

 

I don't know what to do next. I presume I need to open a connection with the server. I tried this (I used reverse DNS to get the hostname from the IP address, which is probably bad because some reverse DNS lookups will probably fail):

 

'this always times out

target = New System.Net.Sockets.TcpClient(EndHost, EndPort)

 

 

I searched google and planet source code supposedly has a sample proxy server in VB.NET, but I can't get to the site.

Posted

Why doesnt this work?

 

IPSocket = New Socket(Net.Sockets.AddressFamily.InterNetwork, SocketType.Stream, ProtocolType.Tcp)

Dim IPHost As IPHostEntry = Dns.GetHostByAddress("192.168.0.1")

Dim sEndPoint As New IPEndPoint(IPHost.AddressList(0).Address, EndPort)

IPSocket.Connect(sEndPoint)

 

 

Dns.GetHostByAddress crashes...

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...