EldoS | Feel safer!

Software components for data protection, secure storage and transfer

Multiple Clients With Same IP

Also by EldoS: SecureBlackbox
200+ components and classes for digital security, signing, encryption and secure networking.
#2985
Posted: 05/25/2007 07:28:32
by Adam Leyshon (Standard support level)
Joined: 05/08/2007
Posts: 23

Just a question, If I have 2 Clients connected to a server but have the same external IP (i.e.Router) and want to send a message to one of them does MsgConnect send it to both computers? (TCP Sockets)

Client 1 Socket:123.123.123.123:14583 -> Server
Client 2 Socket:123.123.123.123:14583 -> Server
Server -> Client 1
Server -> Client 2

or just
Server -> Client 1 because its the first one connected
#2986
Posted: 05/25/2007 07:57:10
by Adam Leyshon (Standard support level)
Joined: 05/08/2007
Posts: 23

OK, I've got more info that may be of use.
In my program I have a Hash table that stores the Hash of the computer name and the IP:Port associated in a table like this:
Code
HASH        |NAME,IP,PORT
---------------------------------
12312312  |C1,123.123.123,5405
---------------------------------
45645645  |C2,123.123.123,5405
---------------------------------

Etc.

What I need to do is send a message (e.g. "RESULTS:")
to the computer that requested it.
I have already sent the result (Args.Message.Result = 10) meaning that the request has been acknowledged.

and to do a lookup I use:
Code
Try
  If Computers.ContainsKey(Computer) = True Then
    'If it does get the IP
    ComputerData = Split(CStr(Computers.Item(Computer)), ",")
    Dim Client As String = "Socket:" & ComputerData(1) & ":14583|KeepAlive"
  End If
Catch ex As Exception
End Try
#2987
Posted: 05/25/2007 08:26:17
by Eugene Mayevski (EldoS Corp.)

Your server sends delayed replies, doesn't it?
In this case you need to save the client's address when you receive the original request. Use GetMessageSource to obtain the address which can be used later to reply to this particular client. This address is not just an IP:Port, but also a couple of magic numbers which will help MsgConnect identify the client.


Sincerely yours
Eugene Mayevski
#2989
Posted: 05/25/2007 10:02:57
by Adam Leyshon (Standard support level)
Joined: 05/08/2007
Posts: 23

When I Save then Source Address I get this:
ComputerData = McMessenger1.GetMessageSource(MSG)
which gives "Socket:3:3:192.168.0.2:14583"

Now when I Do MCMessenger1.PostMessage(ComputerData, Msg, MonCreds) I get Bad destination format.

What am I supposed to do with the message source? parse it?
#2990
Posted: 05/25/2007 10:42:21
by Eugene Mayevski (EldoS Corp.)

You missed the QueueName part of the address. When you call PostMessage, your address must include ComputerData followed by the separator and the queue name.


Sincerely yours
Eugene Mayevski
Also by EldoS: CallbackDisk
Create virtual disks backed by memory or custom location, expose disk images as disks and more.

Reply

Statistics

Topic viewed 3788 times

Number of guests: 2, registered members: 0, in total hidden: 0




|

Back to top

As of July 15, 2016 EldoS Corporation will operate as a division of /n software inc. For more information, please read the announcement.

Got it!