Google Groups no longer supports new Usenet posts or subscriptions. Historical content remains viewable.
Dismiss

vb.net and winsock

0 views
Skip to first unread message

sid

unread,
Nov 18, 2009, 4:34:05 PM11/18/09
to
I am converting some apps from vb6 to vb.net and I need to implement
the functionality of a winsock. I am finding out that .Net does not
support a classic winsock control, but now expects you to use the
Sockets class and code a lot of the functionality yourself ?

Question: 1.) Most of the posts I haved visited talk about the lack
of a winsock and work-arounds are dated about '02 - '05, In the mean
time has Microsoft come out winsock control for .Net ?


2.) I found two examples of Winsock controls written in vb.net and
can simply be added to you solution:
a.) http://www.planet-source-code.com/vb/scripts/ShowCode.asp?txtCodeId=6...
b.) http://www.codeproject.com/KB/vb/winsockdotnet.aspx?msg=3209348


Does anyone have any experience with any of these homegrown controls
and would you use them as is ? as a compiled control or added to you
solution as a user control ?
Or: Would you just add the Microsoft winsock from the COM tab under
references ?


Thanks

Tom Shelton

unread,
Nov 18, 2009, 5:32:39 PM11/18/09
to
On 2009-11-18, sid <sidw...@alexian.net> wrote:
> I am converting some apps from vb6 to vb.net and I need to implement
> the functionality of a winsock. I am finding out that .Net does not
> support a classic winsock control, but now expects you to use the
> Sockets class and code a lot of the functionality yourself ?
>

What specific functionality? You don't have to use the Socket class, there is
also the TcpListner and TcpClient classes. Which provide a simplified
interface. These classes support asynchronous calls and notification via
callbacks...

> Question: 1.) Most of the posts I haved visited talk about the lack
> of a winsock and work-arounds are dated about '02 - '05, In the mean
> time has Microsoft come out winsock control for .Net ?
>

No. TcpClient/TcpListener are the closest your going to get.

>
> 2.) I found two examples of Winsock controls written in vb.net and
> can simply be added to you solution:
> a.) http://www.planet-source-code.com/vb/scripts/ShowCode.asp?txtCodeId=6...
> b.) http://www.codeproject.com/KB/vb/winsockdotnet.aspx?msg=3209348
>
>
> Does anyone have any experience with any of these homegrown controls
> and would you use them as is ? as a compiled control or added to you
> solution as a user control ?
> Or: Would you just add the Microsoft winsock from the COM tab under
> references ?

No. I would learn to use the .NET socket classes. It's not all that hard,
and is in fact far superior in both performance and scalability then the old
winsock control...

--
Tom Shelton

sid

unread,
Nov 19, 2009, 9:18:40 PM11/19/09
to
On Nov 18, 4:32 pm, Tom Shelton <tom_shel...@comcastXXXXXXX.net>
wrote:

> On 2009-11-18, sid <sidwe...@alexian.net> wrote:
>
> > I am converting some apps from vb6 to vb.net and I need to implement
> > the functionality of a winsock.  I am finding out that .Net does not
> > support a classic winsock control, but now expects you to use the
> > Sockets class and code a lot of the functionality yourself ?
>
> What specific functionality?  You don't have to use the Socket class, there is
> also the TcpListner and TcpClient classes.  Which provide a simplified
> interface.  These classes support asynchronous calls and notification via
> callbacks...  
>
> > Question: 1.)  Most of the posts I haved visited talk about the lack
> > of a winsock and work-arounds are dated about '02 - '05, In the mean
> > time has Microsoft come out winsock control for .Net ?  
>
> No. TcpClient/TcpListener are the closest your going to get.  
>
>
>
> > 2.)  I found two examples of Winsock controls written in vb.net and
> > can simply be added to you solution:
> >   a.)http://www.planet-source-code.com/vb/scripts/ShowCode.asp?txtCodeId=6...
> >   b.)http://www.codeproject.com/KB/vb/winsockdotnet.aspx?msg=3209348

>
> > Does anyone have any experience with any of these homegrown controls
> > and would you use them as is ?  as a compiled control or added to you
> > solution as a user control ?
> > Or: Would you just add the Microsoft winsock from the COM tab under
> > references ?
>
> No.  I would learn to use the .NET socket classes.  It's not all that hard,
> and is in fact far superior in both performance and scalability then the old
> winsock control...
>
> --
> Tom Shelton

Do you have any examples of how to set up the callbacks ?

Armin Zingler

unread,
Nov 20, 2009, 6:59:58 AM11/20/09
to
sid schrieb:

>> No. I would learn to use the .NET socket classes. It's not all that hard,
>> and is in fact far superior in both performance and scalability then the old
>> winsock control...
>>
>> --
>> Tom Shelton
>
> Do you have any examples of how to set up the callbacks ?

For example, the TcpClient.BeginConnect method takes an AsyncCallback Delegate.
The asynchronous programming pattern is used throughout the framework and
is described here: http://msdn.microsoft.com/en-us/library/ms228969.aspx
(or respectively the same via F1) There you'll also find examples.

--
Armin

0 new messages