473,385 Members | 1,486 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,385 software developers and data experts.

System.Net.Sockets Quickie

Jm
Hi All

Im trying to get a bit of background info on .net.sockets for an app that im
upgrading to be .net. Under vb6 i used the winsock control and would start
it listening and it would call an event once the connection attempt is made
to it and you would do all you had to do, close the connection and reopen. I
cant seem to find out how this works with .net.sockets. The code i have seen
seems to always talk about listening only the once for the connection and
once done using the connection it closes the connection and ends the
program. Im assuming it is possible to reopen the connection without exiting
the program and wait for another connection ? Any help is greatly
appreciated

Thanks
Nov 21 '05 #1
2 1209
Here is a link to an article that uses a timer to continually listen and
process.

http://www.devcity.net/forums/faq.as...nsock#TID29475
--
Mike

Mike McIntyre
Visual Basic MVP
www.getdotnetcode.com

"Jm" <ja*****@ihug.com.au> wrote in message
news:cp**********@lust.ihug.co.nz...
Hi All

Im trying to get a bit of background info on .net.sockets for an app that
im
upgrading to be .net. Under vb6 i used the winsock control and would start
it listening and it would call an event once the connection attempt is
made
to it and you would do all you had to do, close the connection and reopen.
I
cant seem to find out how this works with .net.sockets. The code i have
seen
seems to always talk about listening only the once for the connection and
once done using the connection it closes the connection and ends the
program. Im assuming it is possible to reopen the connection without
exiting
the program and wait for another connection ? Any help is greatly
appreciated

Thanks

Nov 21 '05 #2
On 2004-12-15, Jm <ja*****@ihug.com.au> wrote:
Hi All

Im trying to get a bit of background info on .net.sockets for an app that im
upgrading to be .net. Under vb6 i used the winsock control and would start
it listening and it would call an event once the connection attempt is made
to it and you would do all you had to do, close the connection and reopen. I
cant seem to find out how this works with .net.sockets. The code i have seen
seems to always talk about listening only the once for the connection and
once done using the connection it closes the connection and ends the
program. Im assuming it is possible to reopen the connection without exiting
the program and wait for another connection ? Any help is greatly
appreciated

Thanks


There are a couple of ways to accomplish your task... The best way,
IMHO, is to make use of the BeginXXX methods on the System.Net.Socket
class.

Here is a good starting place for information on using .NET sockets:

http://msdn.microsoft.com/library/de...consockets.asp

You will want to look particularly at the "Listening with Sockets"
section. You'll find that it will expose you to both Syncronous and
Asynchronous server sockets. Using async sockets requires a tad more
coding - but ultimately it is the most effeceint.

--
Tom Shelton [MVP]
Nov 21 '05 #3

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

4
by: Sagaert Johan | last post by:
i get this error if i write this : using System.Net.Sockets; .... .... TcpClient tcp; tcp=new TcpClient();
4
by: BadOmen | last post by:
Hi, What is the different between 'System.Net.Sockets.Socket' and 'System.Net.Sockets.TcpClient'? When do I use System.Net.Sockets.TcpClient and System.Net.Sockets.Socket?? Yours, Jonas
2
by: Stressed Out Developer | last post by:
We have an application that has a 200 count loop that does the following: ' Each time thru the loop we pass the next IP Address is a range (aka 192.168.4.50 thru 192.168.4.254) Try If...
3
by: J C | last post by:
Hi, I'm using UDPClient to make a simple DNS server. I notice that intermittently and unpredictibly I get: Unhandled Exception: System.Net.Sockets.SocketException: An existing connection...
1
by: CloudSolutions | last post by:
Introduction: For many beginners and individual users, requiring a credit card and email registration may pose a barrier when starting to use cloud servers. However, some cloud server providers now...
0
by: Faith0G | last post by:
I am starting a new it consulting business and it's been a while since I setup a new website. Is wordpress still the best web based software for hosting a 5 page website? The webpages will be...
0
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 3 Apr 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome former...
0
by: aa123db | last post by:
Variable and constants Use var or let for variables and const fror constants. Var foo ='bar'; Let foo ='bar';const baz ='bar'; Functions function $name$ ($parameters$) { } ...
0
by: ryjfgjl | last post by:
If we have dozens or hundreds of excel to import into the database, if we use the excel import function provided by database editors such as navicat, it will be extremely tedious and time-consuming...
0
by: ryjfgjl | last post by:
In our work, we often receive Excel tables with data in the same format. If we want to analyze these data, it can be difficult to analyze them because the data is spread across multiple Excel files...
0
BarryA
by: BarryA | last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
0
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.