954,517 Members — Technology Publication meets Social Media
Username:
Password:
Lost login information?
Have something to say? Contribute New Article Reply to this Article

VB.net SOCKETS

After several hours of searching the web and the student MSDN archive in Visual Studio.net i cannot figure out through the random blabber of sample codes how to do basic connections using TCP socket connections through a client and a listener. I got the jist that winsock had become outdated to Microsoft and they attempted something new, but it all seems to complicated for microsoft to have done. If anyone can point me in the right direction on basic TCP connections, much thanks to ya.
-Tyreses

Tyreses
Light Poster
25 posts since Apr 2005
Reputation Points: 10
Solved Threads: 0
 

Ok i have figured out the basics but now im running into a different issue.

Dim address As new IPAddress() Dim port As Integer = Val(txtport.text) Dim EndPoint As New IPEndPoint(address, port)

when i try to enter an ipaddress such as 127.0.0.1 directly into the ipendpoint, it doesnt accept it, and putting an ipaddress into a long doesnt work either, im at a stall point here of how to get txtip.text into the endpoint...

Tyreses
Light Poster
25 posts since Apr 2005
Reputation Points: 10
Solved Threads: 0
 

Once again with a little time and effort, i figured out the issue, now i cant figure out this one. Using the code provided form the MSDN archive, i altered it ecept the lines with "e" in them.
Try
socket.Bind(endpoint)
Catch e As Exception
Console.WriteLine("Winsock error: " & e.ToString())
End Try

It says "Variable 'e' hides a variable in an enclosing block." I have no idea how to fix this.

Tyreses
Light Poster
25 posts since Apr 2005
Reputation Points: 10
Solved Threads: 0
 

Like in winsock you need two applications to do a tcp socket program . A Server and Client.

you start the server like

Dim serverSocket As New TcpListener(8888)

and connect the client like

clientSocket.Connect("127.0.0.1", 8888)

visti this link

http://vb.net-informations.com/communications/vb.net_Server_Socket.htm

http://vb.net-informations.com/communications/vb.net_Client_Socket.htm

lee_suko
Newbie Poster
2 posts since Jun 2008
Reputation Points: 10
Solved Threads: 0
 

This article has been dead for over three months

Post: Markdown Syntax: Formatting Help
You