Board index » delphi » Indy UDP on Terminal Services or Multi Session (3rd POST)

Indy UDP on Terminal Services or Multi Session (3rd POST)

There must be a way around this?

I need to run a app that has a UDP client on Terminal Services, surely there
is a way to do this?

I hate to say this but the FastNet UDP component works fine. I need a
solution please, if anyone can help I would be very appreciative.

Dan

Quote
"Rocco Kreutz" <kre...@kgo-consulting.de> wrote in message

news:3ED22458.3090401@kgo-consulting.de...
Quote
> hm, on 1 machine every port can be bound only 1 time (afaik).
> so you should change ports for every instance of your programm.

> rk

> Daniel Jeffrey schrieb:
> > I  have a UDP client on a form that is open when the Application opens.

> > The problem is if I open more than 1 copy, or the app is open on
Terminal
> > Services I get msg's about "Cannot Bind to Port XXXX"

> > How can I get around this?

> > Daniel

 

Re:Indy UDP on Terminal Services or Multi Session (3rd POST)


Quote
"Daniel Jeffrey" <da...@ozemail.com.au> wrote in message

news:3edfdcf4@newsgroups.borland.com...

Quote
> I need to run a app that has a UDP client on
> Terminal Services, surely there is a way to
> do this?

It might help if you would explain the actual problem you are having.

Gambit

Re:Indy UDP on Terminal Services or Multi Session (3rd POST)


I did in the bottom of the message (it was a re-post)

I  have a UDP client on a form that is open when the Application opens.

The problem is if I open more than 1 copy, or the app is open on Terminal
Services I get msg's about "Cannot Bind to Port XXXX"

How can I get around this?

Daniel

"Remy Lebeau (TeamB)" <gambi...@yahoo.com> wrote in message
news:3edfe391$1@newsgroups.borland.com...

Quote

> "Daniel Jeffrey" <da...@ozemail.com.au> wrote in message
> news:3edfdcf4@newsgroups.borland.com...

> > I need to run a app that has a UDP client on
> > Terminal Services, surely there is a way to
> > do this?

> It might help if you would explain the actual problem you are having.

> Gambit

Re:Indy UDP on Terminal Services or Multi Session (3rd POST)


Quote
"Daniel Jeffrey" <da...@ozemail.com.au> wrote in message

news:3ee3f3f7@newsgroups.borland.com...

Quote
> The problem is if I open more than 1 copy, or the
> app is open on Terminal Services I get msg's about
> "Cannot Bind to Port XXXX"

Well, if you have multiple instances of your application running at the same
time and are trying to bind to the same IP/Port at the same time, then of
course it is going to fail.  You can only bind one socket to a particular
given IP/Port combo at a time.  Is there any particular reason why you are
trying to bind your *client* socket in the first place?  Client sockets are
not usually explitically bound to particular ports, but are assigned 0 so
that the IP stack can assign random ports instead, to avoid such conflicts.

Gambit

Re:Indy UDP on Terminal Services or Multi Session (3rd POST)


How does it read then when a message is sent?
I am confused.

Dan
"Remy Lebeau (TeamB)" <gambi...@yahoo.com> wrote in message
news:3ee3fd12$1@newsgroups.borland.com...

Quote

> "Daniel Jeffrey" <da...@ozemail.com.au> wrote in message
> news:3ee3f3f7@newsgroups.borland.com...

> > The problem is if I open more than 1 copy, or the
> > app is open on Terminal Services I get msg's about
> > "Cannot Bind to Port XXXX"

> Well, if you have multiple instances of your application running at the
same
> time and are trying to bind to the same IP/Port at the same time, then of
> course it is going to fail.  You can only bind one socket to a particular
> given IP/Port combo at a time.  Is there any particular reason why you are
> trying to bind your *client* socket in the first place?  Client sockets
are
> not usually explitically bound to particular ports, but are assigned 0 so
> that the IP stack can assign random ports instead, to avoid such
conflicts.

> Gambit

Re:Indy UDP on Terminal Services or Multi Session (3rd POST)


Quote
"Daniel Jeffrey" <da...@ozemail.com.au> wrote in message

news:3ee45b3c@newsgroups.borland.com...

Quote
> How does it read then when a message is sent?
> I am confused.

What EXACTLY are you trying to accomplish?  What does your actual code lok
like that is failing?

Gambit

Re:Indy UDP on Terminal Services or Multi Session (3rd POST)


Gambit,

Hope you don't mind me sending direct.

The UDP componet is used for 2 things.

The software that it is in is Client/Server (MS SQL).

1. Users can send messages to each other via the Client. There for there is
a UDPClient and UDPServer in the software. When a UDP message is sent the
User chooses a user(s) from a list and a array of char is sent over UDP to
all clients, the client then gets the string and works out if it is for the
user and displays the message.

2. Scheduling. My software has a database driven schedule component. A local
list of schedule items (for reminders) is stored in local memory so I can
prompt users when needed. The software enables the user to schedule for
other people. If this happens it was sending a UDP message to the other
client telling them to update the Local list from the DB.

I hope this helps.

Client and Server were set to Port 2231.

My code is simple.

//When a message is received.

procedure TPrimaryForm.MessageRecUDPRead(Sender: TObject; AData: TStream;

ABinding: TIdSocketHandle);

var

DataStringStream: TStringStream;

s: String;

begin

s := '';

DataStringStream := TStringStream.Create('');

try

DataStringStream.CopyFrom(AData, AData.Size);

s := SysUtils.Trim(DataStringStream.DataString);

finally

DataStringStream.Free;

end;

If Length(s) > 0 then

ProcessTheMessage(s,ABinding.PeerIP);

end;

Procedure TPrimaryForm.CreateUDPComp;

Begin

MessageRec.Active := True;

SendUDP := TIdUDPClient.Create(Self); //This is in a Library File so other
units have easy access to it.

SendUDP.Port := 2231;

End;

procedure SendUDPMessage(TheComp : TIdUDPClient; Host : String; TheMessage :
String); Begin

With TheComp Do

Begin

Host := Host;

Send(TheMessage);

End;

End;

"Remy Lebeau (TeamB)" <gambi...@yahoo.com> wrote in message
news:3ee4c9f3$1@newsgroups.borland.com...

Quote

> "Daniel Jeffrey" <da...@ozemail.com.au> wrote in message
> news:3ee45b3c@newsgroups.borland.com...
> > How does it read then when a message is sent?
> > I am confused.

> What EXACTLY are you trying to accomplish?  What does your actual code lok
> like that is failing?

> Gambit

Other Threads