|
-
Aug 8th, 2002, 09:18 PM
#1
Thread Starter
Addicted Member
UPD Sockets
Hello,
I have been trying to get this UPD socket thing to work off and on for the last couple of weeks but I just seem to be missing something. I was wondering if anyone could show me how to setup a UDP socket so that I can listen for incomming data on port 1132 from any host.
I have also been to the microsoft site and planetsourcecode but just are unable to get the stupid thing to work.
Jeremy
-
Aug 9th, 2002, 10:27 PM
#2
Thread Starter
Addicted Member
Ok here is what i have so far, if i un comment the send I can send data on the correct port, but if i un comment the recieve it will not recieve any data and never gets to the message box (I am assuming it doesn't get the the message box because it is not getting any data). Any ideas?
Jeremy
Imports System.Net.Sockets
Imports System.Net
Imports System.Text
Module Module1
Public Sub Main()
Dim sendBytes As [Byte]() = Encoding.ASCII.GetBytes("Is anybody there yet?")
Dim ipadd As IPAddress = IPAddress.Parse("127.0.0.1")
Dim port As Integer = 1132
Dim wsck As New UdpClient()
Dim endpoint As New IPEndPoint(ipadd, port)
Dim done As Boolean = False
wsck.JoinMulticastGroup(ipadd)
wsck.Connect(endpoint)
'wsck.Send(sendBytes, sendBytes.Length)
Dim socketdata As Byte() = wsck.Receive(endpoint)
MsgBox("Done")
End Sub
End Module
-
Aug 10th, 2002, 12:45 AM
#3
Thread Starter
Addicted Member
Never mind, after some serious scouring of the net I found out how to do it. In three lines of code none the less.
Jeremy
-
Aug 10th, 2002, 12:53 AM
#4
Originally posted by Jeremy Martin
Never mind, after some serious scouring of the net I found out how to do it. In three lines of code none the less.
Jeremy
well it would be nice if you post the code so if someone else needs it can use it
Posting Permissions
- You may not post new threads
- You may not post replies
- You may not post attachments
- You may not edit your posts
-
Forum Rules
|
Click Here to Expand Forum to Full Width
|