[Okta Webinar] Learn how to a build a cloud-first strategyRegister Now

  • Status: Solved
  • Priority: Medium
  • Security: Public
  • Views: 352
  • Last Modified:

UDP server client

Hi i am new to VB.net and i am supposed to code a UDP server and client which just measures the RTT. I  really dont know where to start...as this has to be broadcast server. And it has  2 or more clients .....
Can anyone post me some sample code to start ....
  • 2
1 Solution
Ignacio Soler GarciaCommented:
What is the RTT? By the way, Im doing also a UDP Server, just start to play with this:

Imports System.Net
Imports System.Net.Sockets

Public Class ClassBootPServer
    Public Sub New()
    End Sub

    Private Sub Listen(ByVal vPort As Integer)
        Dim server As UdpClient
        Dim RemoteIpEndPoint As IPEndPoint
        Dim byteMessage As Byte()

        server = New UdpClient(vPort)
        RemoteIpEndPoint = New IPEndPoint(IPAddress.Any, 0)
        byteMessage = server.Receive(RemoteIpEndPoint)
    End Sub
End Class

This will read only one message. There are some ways to read endlessly:

a) With one thread that reads and stores the data in a buffer:
b) With a While true loop

While true
        byteMessage = server.Receive(RemoteIpEndPoint)
End while

Askme more if you need it.


prashanth_gurijalaAuthor Commented:
Thanx ... RTT is round trip time the time taken the packet to reach client and return back to server. i will check this out and reply back to you....
thanx for evrything...
prashanth_gurijalaAuthor Commented:
Hi thanx for your help. The problem is that i have one server and 3 clients( may be more depends) server sends packets and client echoes them back and server calculates the time taken by packet to go to client and reach back to server.

 and ony udp should be used as i will set broadcast option... later...

if u can direct me that would be lot more helpful....

This project will be integrated into a larger module for calulating signal strengths etc. Completed all but  got struck on this module...

thanx for your help..


Featured Post

Technology Partners: We Want Your Opinion!

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!

  • 2
Tackle projects and never again get stuck behind a technical roadblock.
Join Now