I have the following scenario:
WCF HOST SERVER<-- network connect to --> WCF LAPTOP CLIENT <-- connected to --> WCF CLIENT 2
I also have a WCF HOST CLIENT, whcih has a UI, on the server machine where WCF HOST SERVER is. This client calls services on the HOST SERVER.
I have hooked up the WCF HOST CLIENT to list the connected WCF LAPTOP CLIENTS; I have used a duplex connection so that if I double click one of the connected laptop clients, the duplex chanel is used to communicate back to the selected WCF LAPTOP CLIENT.
But instead of a string message, I need to stream a large data file back to the WCF LAPTOP CLIENT. I can't stream using the callback channel because duplex doesn't allow streaming.
NOTE: I have to use NetTcpBinding for this by the requirements.
All WCF LAPTOP CLIENTS use the same IP and PORT.
So the question is how can I select a connected laptop on the WCF HOST CLIENT UI, and send a stream object back to the selected laptlop? Since the callback channel knows where the laptop is can I somehow use that information to open a new wcf connection (or a new socket connection) to that specific laptop? I do use a guid to register each laptop on the WCF HOST CLIENT and use that to determine which WCF LAPTOP CLIENT to send a string message back.
WHAT I'VE TRIED: I have tried using the callback message at the WCF LAPTOP CLIENT to call a different service from the HOST SERVER; this works and returns a string message from the HOST SERVER to the specific LAPTOP CLIENT but I can't send byte data back because I get a contract mismatch error.
What I actaully have to do is send a large file to the laptop from the server and then forwward that file to WCF CLIENT 2 which is only connected to the laptop, not to the network. WCF CLIENT 2 is actually a small box with XP on it. Unless I know which laptop to send the file to, all laptops will receive it and I only need the selected laptop to receive the file then forward it to its connected box. I am using a socket connection to do the forwarding between the laptop and the box.
Any insight or help would be ap开发者_JAVA技巧preciated.
One way to do it is to host another service on the server side that does allow streaming. Just send a message via the duplex channel to the laptop with the location and some sort of identifier to do the download using the other service.
精彩评论