En/na PC Pete ha escrit:
>
> What I can’t seem to get working is the Synapse UDP send/receive. I can
> send packets without errors, and the module appears to receive them (the
> activity LED flashes and it only flashes when I actually send these
> packets), but I never, ever, receive anything back from the module.
> Wireshark tells me it’s returning the data to my IP and port number, but
> I just can’t see it in Synapse event handler for received packets.
I'm using a TUdpBlockSocket in a thread to communicate with a device
that listens on an UDP socket and it's working fine, I just do something
like:
Fsock:=TUdpBlockSocket.create;
FSock.Connect(address,port);
while not terminated do
begin
if Something_to_send then
begin
FSock.SendString(MessageToSend+chr(13));
FReceived:=Fsock.RecvTerminated(FTimeout,chr(13));
if FReceived<>'' then
begin
//do something with FReceived
end;
end;
end;
and it works fine (24 hours a day actually). It's under Linux, but I
don't see why it shouldn't work under windows as well (apart from the
fact that windows networking is quite broken, but that's another issue).
>
> I suspect that I need to somehow bind the UDP socket to the specific
> adapter (i.e. NIC2), but I don’t know how to do that correctly!
I don't know either, but instead of an adapter you bind to an ip
address: it's the operating system job to select the adapter
corresponding to the ip.
But in my case it wasn't necessary.
[...]
> The problem for me (I think!) is that the module sends the data to the
> IP address I specify as the local host, but it seems to send it to the
> wrong MAC address. I think that’s where I’m going wrong, but I don’t
> want to have to manually enter the MAC address each time I start the
> app, since there’s no guarantee I won’t upgrade the NIC on that network.
> So if it’s possible, I’d like to use Synapse to present a list of
> adapters, select the adapter I want to use, then use Synapse to use that
> adapter from then onwards.
Again, that's the operating system job, not yours. You just connect/send
to an ip address, the os will look at the routing table to decide which
adapter to use.
Bye
--
Luca
------------------------------------------------------------------------------
Let Crystal Reports handle the reporting - Free Crystal Reports 2008 30-Day
trial. Simplify your report design, integration and deployment - and focus on
what you do best, core application coding. Discover what's new with
Crystal Reports now. http://p.sf.net/sfu/bobj-july
_______________________________________________
synalist-public mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/synalist-public