Click here to Skip to main content
15,892,809 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
See more:
Hallo Dear Everyone,

How can I create a connection between client and server, rather than using TCP/IP(Socket)?
I have heard that is possible, posting and getting messages from a given URL. For example, consider there two machines, MachineA and MachineB. MachineA has to always check for an incoming message on at a given URL, and MachineB sends or puts a message on that given URL. This has to work in vice versa, MachineA may act as MachineB and MachineB may act as MachineA.

I think it is possible to use the HttpListner class for such problem.
Is that possible?

Thank You
Posted
Updated 27-Jan-11 5:47am
v3

While Nishant Sivakumar has provided an excellent answer, you could also take a look at:
MessageQueue[^] - the .Net interface to MSMQ.

Take a look at MessageQueue.BeginReceive[^] - depending on what you are doing, this might be both more flexible, and easier to implement.

Using MSMQ with WCF is also an option...

Regards
Espen Harlinn
 
Share this answer
 
I know a webpage where there is a solution like that wether i don't know if it is using TCP/IP or not.

Here is the link: how-to-create-a-callback-form-using-the-c-sip-voip-softphone-source-voip[^]

Hope it is helpful
 
Share this answer
 
You can do this via WCF. MachineA subscribes to a callback service on ServerC. MachineB connects to ServerC and periodically sends messages, and MachineA automatically receives them via the callback.

[Update]
--------------

In response to your updated question, while you can use HttpListener, now you would not automatically get callbacks (which is there in WCF). And WCF supports HTTP protocols too for communication. So there's no real need to avoid WCF. But if you don't want to go the WCF route, you can write your own server app, except that the client machines would either need to poll the server or you'd need to implement some kind of thin listening server on each client to simulate/facilitate a push based callback mechanism.
 
Share this answer
 
v5
Comments
Espen Harlinn 27-Jan-11 13:38pm    
5+ Good answer :)
fjdiewornncalwe 27-Jan-11 14:58pm    
Very nice...
Nish Nishant 27-Jan-11 16:30pm    
Thank you, Espen and Marcus.
shakil0304003 28-Jan-11 0:00am    
Good Answer :)
Nish Nishant 28-Jan-11 9:36am    
Thank you, Shakil.

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900