Solved

System.Net.Sockets.Tcplistener  :: Explained

Posted on 2004-10-17
3
607 Views
Last Modified: 2011-10-03
Can someone please explain System.Net.Sockets.Tcplistener for me ?
0
Comment
Question by:addicktz
  • 2
3 Comments
 
LVL 9

Expert Comment

by:checoo
ID: 12336292
0
 
LVL 5

Accepted Solution

by:
KarcOrigin earned 350 total points
ID: 12336306
Hi,
Tcplistener is a class that listen the TCP connetions. If you have work with WinSocket control this class behaves like a that. It listen and accept incoming connection requests. You can initiate this class by providing IP address and the port number. If you do not know the IP address of the machine on which you are initiating this class you can also use Any keyword.
Example -
Private listener As TcpListener
listener = New TcpListener(System.Net.IPAddress.Any, YourPortNumber)
listener.Start() method will start the listener to listen any incoming request from other TCP clients.
After start listening to the incoming request you have to make a listening loop that will wait and listen any incoming client connection request

While True
  Dim client As TcpClient = server.AcceptTcpClient() ' On this line your code will stop and wait for any incoming client request
  ' Now you can use client (TcpClient) property and methods
  client.GetStream ' This method is perticularly useful to read and send the data to the connected client
  client.Close ' Shutdown and end connection
End While

This is just an overview of Tcplistener class. For more detail explanation please visit to
http://msdn.microsoft.com/library/default.asp?url=/library/en-us/cpref/html/frlrfsystemnetsocketstcplistenerclasstopic.asp
Thanks
0
 
LVL 5

Expert Comment

by:KarcOrigin
ID: 12336309
O..O I was writing my comments in the mean time checoo pops up with the same link!

Caio
0

Featured Post

3 Use Cases for Connected Systems

Our Dev teams are like yours. They’re continually cranking out code for new features/bugs fixes, testing, deploying, testing some more, responding to production monitoring events and more. It’s complex. So, we thought you’d like to see what’s working for us.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Suggested Solutions

Introduction As chip makers focus on adding processor cores over increasing clock speed, developers need to utilize the features of modern CPUs.  One of the ways we can do this is by implementing parallel algorithms in our software.   One recent…
It’s quite interesting for me as I worked with Excel using vb.net for some time. Here are some topics which I know want to share with others whom this might help. First of all if you are working with Excel then you need to Download the Following …
In a recent question (https://www.experts-exchange.com/questions/28997919/Pagination-in-Adobe-Acrobat.html) here at Experts Exchange, a member asked how to add page numbers to a PDF file using Adobe Acrobat XI Pro. This short video Micro Tutorial sh…
This video shows how to use Hyena, from SystemTools Software, to bulk import 100 user accounts from an external text file. View in 1080p for best video quality.

821 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question