?
Solved

question about winsock UDP protocol

Posted on 2005-04-08
1
Medium Priority
?
773 Views
Last Modified: 2013-11-13
hi, all, i have the following code:

Private Sub Form_Load()

    bcWinsock.Protocol = sckUDPProtocol
    bcWinsock.RemoteHost = "255.255.255.255"
    bcWinsock.RemotePort = 1111
    bcWinsock.LocalPort = 1007
    bcWinsock.Bind 1007
End Sub

Private Sub bcWinsock_DataArrival(ByVal bytesTotal As Long)
    Dim helloInfo As String
    Dim serverInfo As String
   
    bcWinsock.GetData helloInfo

    statusText.Text = statusText.Text + helloInfo
   
   
    severInfo = "info from server"
    bcWinsock.SendData serverInfo
     
End Sub


the following run time error happened when executing "bcWinsock.SendData serverInfo" :

Run-time error '10065':
No route to host .

does anyone know what's going on?  thanks in advance.

xiao
0
Comment
Question by:yuexb
1 Comment
 
LVL 29

Accepted Solution

by:
nffvrxqgrcfqvvc earned 1000 total points
ID: 13741454
'UDP packets don't go past the routher..from what I know if your connecting within your LAN then udp protocal will work, if you are trying to connect outside it won't work.

from what I see you are trying to broadcast the udp server..

'This is how I do it using UDP

'''''''''''''''''''''''''''
SERVER SIDE
'''''''''''''''''''''''''''

Private Sub Form_Load()

    Winsock1.RemotePort = 2002
    Winsock1.RemoteHost = "255.255.255.255"
    Winsock1.Bind 2001

End Sub

Private Sub Winsock1_DataArrival(ByVal bytesTotal As Long)
Dim sTr As String
Winsock1.GetData sTr
MsgBox sTr, vbInformation, "UDP Broadcasting"


End Sub





''''''''''''''''''''''''
CLIENT / ADMIN SIDE
'''''''''''''''''''''''''


Private Sub Command1_Click()
Dim sTr As String
sTr = "Broadcast using UDP"
Winsock1.SendData sTr
End Sub

Private Sub Form_Load()
With Winsock1
        .RemoteHost = "255.255.255.255"   ' Broadcast IP
        .RemotePort = 2001         ' Port to connect to.
        .Bind 2002                       ' Bind to the local port.
    End With

End Sub
0

Featured Post

Free Tool: Path Explorer

An intuitive utility to help find the CSS path to UI elements on a webpage. These paths are used frequently in a variety of front-end development and QA automation tasks.

One of a set of tools we're offering as a way of saying thank you for being a part of the community.

Question has a verified solution.

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

Background What I'm presenting in this article is the result of 2 conditions in my work area: We have a SQL Server production environment but no development or test environment; andWe have an MS Access front end using tables in SQL Server but we a…
If you haven’t already, I encourage you to read the first article (http://www.experts-exchange.com/articles/18680/An-Introduction-to-R-Programming-and-R-Studio.html) in my series to gain a basic foundation of R and R Studio.  You will also find the …
Viewers will learn how to properly install Eclipse with the necessary JDK, and will take a look at an introductory Java program. Download Eclipse installation zip file: Extract files from zip file: Download and install JDK 8: Open Eclipse and …
The viewer will learn how to use the return statement in functions in C++. The video will also teach the user how to pass data to a function and have the function return data back for further processing.
Suggested Courses
Course of the Month14 days, 1 hour left to enroll

807 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