Results 1 to 4 of 4

Thread: UPD Sockets

  1. #1

    Thread Starter
    Addicted Member
    Join Date
    Jul 1999
    Posts
    207

    Angry 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

  2. #2

    Thread Starter
    Addicted Member
    Join Date
    Jul 1999
    Posts
    207
    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

  3. #3

    Thread Starter
    Addicted Member
    Join Date
    Jul 1999
    Posts
    207
    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

  4. #4
    l33t! MrPolite's Avatar
    Join Date
    Sep 2001
    Posts
    4,428
    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
  •  



Click Here to Expand Forum to Full Width