Winsock Question
Winsock Question
Winsock Question
Winsock Question
Winsock Question
Winsock Question Winsock Question Winsock Question Winsock Question Winsock Question Winsock Question Winsock Question Winsock Question
Winsock Question Winsock Question
Winsock Question
Go Back  Xtreme Visual Basic Talk > > > Winsock Question


Reply
 
Thread Tools Display Modes
  #1  
Old 01-19-2006, 10:41 AM
1821 1821 is offline
Newcomer
 
Join Date: Nov 2005
Posts: 23
Default Winsock Question


Hey guys, I was just wondering what the winsock bind method is for and I was also wondering apart from security is there any other major differences between UDP and TCP?

Thanks.
Reply With Quote
  #2  
Old 01-19-2006, 10:48 AM
ollieonfire's Avatar
ollieonfire ollieonfire is offline
Regular
 
Join Date: Jul 2005
Posts: 66
Default

tcp you have to connect to another listtenning winsock control and it has to accept before you can send data.. the other one u can just select a port and ip and just send the data there... if another winsock control is at the destination ip adress then it can recieve it
Reply With Quote
  #3  
Old 01-19-2006, 01:48 PM
1821 1821 is offline
Newcomer
 
Join Date: Nov 2005
Posts: 23
Default

Thanks for your reply, do you know what the bind method is for?

Thanks.
Reply With Quote
  #4  
Old 01-20-2006, 07:14 AM
CyberDude CyberDude is offline
Centurion
 
Join Date: Jul 2003
Posts: 134
Smile Local listen

The bind method makes the local computer receive udp packets. Using the bind method makes your computer listen on a particular port for incoming packets. You must use it in order to receive data from another computer using udp. Here is some code:
With udpText
.bind 1001 'local port on your PC that will receive data from other PC
.remotehost = "192.168.9.1" ' address of remote PC
.remoteport = 1002 ' port of remote PC you can transmit to
End With
Hope this clears it up for you.
Reply With Quote
  #5  
Old 01-20-2006, 10:43 AM
Hade Hade is offline
Newcomer
 
Join Date: Jan 2006
Posts: 12
Default

Quote:
Originally Posted by CyberDude
The bind method makes the local computer receive udp packets. Using the bind method makes your computer listen on a particular port for incoming packets. You must use it in order to receive data from another computer using udp. Here is some code:
With udpText
.bind 1001 'local port on your PC that will receive data from other PC
.remotehost = "192.168.9.1" ' address of remote PC
.remoteport = 1002 ' port of remote PC you can transmit to
End With
Hope this clears it up for you.
Yep, it's the UDP equivalent to TCP's Listen.
Reply With Quote
  #6  
Old 01-20-2006, 03:58 PM
dilettante's Avatar
dilettanteWinsock Question dilettante is offline
Underclocked lifestyle

Forum Leader
* Guru *
 
Join Date: Feb 2005
Location: Michigan, USA
Posts: 4,520
Default

While Bind may seem to resemble Listen for UDP sockets, that isn't what it is doing at all. Bind is normally used with a TCP server as well.

Have you read the manual? It is pretty clear that Bind reserves a local port for use by one socket. This is used to avoid several services "randomly" getting incoming conections when they all try to Listen on the same port. Secondarily it is used in a multihomed or multi-addressed computer to identify which IP address to reserve the port on.

Most consumer versions of Windows only permit one IP address per adapter, and many only have a single network adapter. This is the degenerate case however, and many server applications need the flexibility that the Bind method provides. For example one physical box might have three different web servers running on port 80 on different IP addresses, using one, two, or even three network adapters.

It is true though that in order to "bind" a UDP socket to an address you have to Bind it to a port number and IP address. This defaults to the first active IP connection defined in an internal list of active connections in the machine - and you can't rely on which one this will be at any given time. You can see the current list though when you examine your network connections in Control Panel.
Reply With Quote
Reply


Currently Active Users Viewing This Thread: 1 (0 members and 1 guests)
 
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 Off
HTML code is Off

Forum Jump

Advertisement:





Free Publications
The ASP.NET 2.0 Anthology
101 Essential Tips, Tricks & Hacks - Free 156 Page Preview. Learn the most practical features and best approaches for ASP.NET.
subscribe
Programmers Heaven C# School Book -Free 338 Page eBook
The Programmers Heaven C# School book covers the .NET framework and the C# language.
subscribe
Build Your Own ASP.NET 3.5 Web Site Using C# & VB, 3rd Edition - Free 219 Page Preview!
This comprehensive step-by-step guide will help get your database-driven ASP.NET web site up and running in no time..
subscribe
Winsock Question
Winsock Question
Winsock Question Winsock Question
Winsock Question
Winsock Question
Winsock Question Winsock Question Winsock Question Winsock Question Winsock Question Winsock Question Winsock Question
Winsock Question
Winsock Question
 
Winsock Question
Winsock Question
 
-->