Network Topics include: sockets, protocols and the web

Go Back  Xtreme .NET Talk > .NET > Network > Windows Socket


Reply
 
Thread Tools Display Modes
  #1  
Old 01-08-2003, 09:11 AM
bojanv55 bojanv55 is offline
Newcomer
 
Join Date: Dec 1969
Location: Podgorica, Yugoslavia
Posts: 2
bojanv55 is on a distinguished road
Default Windows Socket

In VB 6.0 I used to add Windows socket control 6.0 (mswinsock.ocx) to my project, and than i could make programs for internet and betwork. Now , in VB.NET i can't find this control. Do i have to use something else instead of this? Like system.net.sockets or something like that. And where to find manual on using it?
Reply With Quote
  #2  
Old 01-08-2003, 09:41 AM
divil's Avatar
divil divil is offline
Ultimate Contributor
 
Join Date: Nov 2002
Location: England
Posts: 2,747
divil is on a distinguished road
Default

You will use either the Socket or TclClient (which wraps Socket) classes in .NET to achieve this. There is at least one example in the framework sdk, and loads around on the internet. The help is, as always, a good reference too.

It's a fair jump from the winsock control to the Socket class, but with enough examples it isn't too difficult.
__________________
MVP, Visual Developer - .NET

Now you see why evil will always triumph - because good is dumb.

My free .NET Windows Forms Controls and Articles
Reply With Quote
  #3  
Old 01-11-2003, 09:02 AM
BusterG BusterG is offline
Newcomer
 
Join Date: Jan 2003
Location: United Kingdom
Posts: 15
BusterG is on a distinguished road
Default

I have the same problem. I was using the Winsock control in VB6 and have now upgraded to VS.Net. The problem I have found is that in all the code samples, the calls to recieve appear to block.

Using the VB6 control, my app used the same port to send and recieve UDP packets to whichever IP address I chose whether the other end was listening or not and just waited for the DataRecieved message. The recipient always sent an acknowledgement when a msg was recieved as a kind of handshake. I don't see how I can achieve the same thing in .Net. certainly not without far more research & coding.
Reply With Quote
  #4  
Old 02-05-2003, 07:53 AM
Spiro Spiro is offline
Newcomer

Preferred language:
VB.NET
 
Join Date: Feb 2003
Location: Croatia
Posts: 15
Spiro is on a distinguished road
Default

You can achieve this with thread in which you can read Pending property of TCPServer class and raise an event. Also,
DataAvailable property of Stream (TcpClient.GetStream) shows you if there is data in recieve buffer. Best manual is MSDN Library.
Reply With Quote
  #5  
Old 02-05-2003, 12:34 PM
BusterG BusterG is offline
Newcomer
 
Join Date: Jan 2003
Location: United Kingdom
Posts: 15
BusterG is on a distinguished road
Default

Thanks but I already solved that problem in a similar way to what you described.

I ended up putting the listening call inside a loop which was called from a thread. As you sugested, I used RaiseEvent when a message was recieved.

As my previous post mentioned, I have upgraded from Visual Studio 6 where I dont believe free threading existed so it took some investigating but I got there in the end :-)
Reply With Quote
Reply

Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off

Forum Jump

Similar Threads
Thread Thread Starter Forum Replies Last Post
Socket struggling JCDenton Network 4 02-21-2005 01:46 AM
socket.beginconnect Drstein99 Network 2 10-23-2004 02:13 PM
need socket help shingo99 Network 16 07-21-2004 08:12 PM
Socket problem georgepatotk Network 6 07-07-2004 11:10 AM
Socket Connection from Windows Application to Pocket PC encryptedheart Network 1 01-06-2004 09:55 AM

Advertisement:

Powered by liquidweb