Re: Can't send data from UDP server to client

Giganews Newsgroups
Subject: Re: Can't send data from UDP server to client
Posted by:  Remy Lebeau (TeamB) (gambit47.no.spam@no.spam.yahoo.com)
Date: Sat, 17 Apr 2004

"Virtek" <oferd…@012.net.il> wrote in message
news:64ED79C2CF99E240oferd…@012.net.il...

> Their properties:
> IdUDPServer1.Active = true
> IdUDPServer1.DefaultPort = 2500

You need to set the Port *before* you activate the server.  You can't do it
afterwards, it has no effect.

> IdUDPClient1.Active = true
> IdUDPClient1.Host = "127.0.0.1" (localhost)
> IdUDPClient1.Port = 2500

Same here as well. You need to set the Host and Port *before* you activate
the client.

>  IdUDPServer1->Send("127.0.0.1",2500,"string");

You are telling the server to send the data back to itself, not to the
client at all.  The server, not the client, is the one listening for data on
port 2500.  You need to look at the client's Binding.Port property to know
which port the client is actually listening on.

>  Label1->Caption = IdUDPClient1->ReceiveString(6);

Since you did not send the data to the client, there is nothing for it to
receive.

Gambit

Replies

None

In response to

Can't send data from UDP server to client posted by Virtek on Sat, 17 Apr 2004