views:

260

answers:

2

How can I configure my WCF service to work as a normal TCP server? Is it possible to disable all that binding specific stuff so as to keep your service URL like http://example.com:4444/service and be able to work vith pure HTTP/TCP streams?

I need to be able to work with TCP streams in tandem with WCF services... so I have to make TCP server from one of my WCF services or (and I do not know how) make my self-hosted WCF services work in pair with my stand alone TCP server. However, I just can not find how to make them share the same port so as to be able to call http://example.com:4444/WCFservice/ http://example.com:4444/TCPserver/ (And I have to make them share it; taking 2 ports is not an option.)

+2  A: 

If you want to work with pure TCP streams you'd probably work with sockets directly and not WCF.

Use WCF when you want things auto implemented for you at the transport layer.

Brian R. Bondy
I need to be able to work with TCP streams in pair with WCF services... so I have to make TCP server from one of my WCF services or (and i do not know how) make my self hosted WCF services work in pair with my stand alone TCP server and I just can not to find how to make them share same port (And I have to make them share it - take 2 ports is not an option) Can you give me any help with it? Please.
Blender
+2  A: 

The easiest way to add TCP endpoint to the service is modify you web.config file with respect of "WCF Service configuration editor". You can find it in the "Tools" menu of Visual Studio of in context menu of web.config (also in VS). You need add new endpoint with netTcpBinding. The address of such new endpoint will be start with "net.tcp://". For more information you can read http://msdn.microsoft.com/en-us/library/cc949080.aspx.

For net.tcp port sharing read http://msdn.microsoft.com/en-us/library/aa395195.aspx or google for: wcf tcp endpoint port sharing.

A good review of new features of WCF 4 you can find in http://msdn.microsoft.com/en-us/library/ee354381.aspx

And take it easy if somebody don't understand advantages of WCF compares with Winsocket programming. 15 year ago I used sockets and find it cool. Then I used RPC, DCOM etc. Now WCF is the best way if you think about authentication of your endpoint. So take some of previous comments easy.

Oleg
my url should not begin with net.tcp... I need to be able to acsess it thru adobe flash for example... So that Flash Java etc clients are used to write to me streams of data using Sockets - I give them url they start writing live camera video stream to it... my TCP server reads it... ... I want to let tham keep it so or in similar way... Is it possible with net.tcp? Can I not serialise messages in it - just make simple addressing system like http://example.com:4444/WCFservice.svc?id=666 ?
Blender
@Ole Jak: the netTcpBinding in WCF is only available through `net.tcp://....` URL's - that's the way it is, if that doesn't work for you, then you need to use something else other than WCF.
marc_s
Sorry Ole, but the string like example.com:4444/WCFservice.svc?id=666 is not an URL. You must define protocol of data exchange at least like "http://..." or "net.tcp://". A real protocol is more then http or tcp. You should have a real contract between clients and server. If you need implements the protocol defined by Flash, you should search for the corresponding example or look in the documentation directly. It seems to me, that you have problem another as Donal Fellows have, which asked the question.
Oleg
I asked the question. asked 21 hours ago Ole Jak
Blender
Sorry Ole, I thought two persons before: you and Donal Fellows as a persons who asked the question. Then I misunderstood you. You asked about TCP features of WCF. I answered. Probably your original problem should be solved with the other way.
Oleg