5
votes

Tooday I use ServiceHost for self hosting WCF cervices.

I want to host near to my WCF services my own TCP programm for direct sockets operations (like lien to some sort of broadcasting TCP stream)

I need control over URL namespaces (so I would be able to let my clients to send TCP streams directly into my service using some nice URLs like example.com:port/myserver/stream?id=1 or example.com:port/myserver/stream?id=anything and so that I will not be bothered with Idea of 1 client for 1 socket at one time moment, I realy want to keep my WCF services on the same port as my own server or what it is so to be able to call www.example.com:port/myWCF/stream?id=222... and I want it to work on Any port - not only 80)

Can any body please help me with this?

I am using just WCF now. And I do not enjoy how it works. That is one of many resons why I want to start migration to clear TCP=)

I can not use net-tcp binding or any sort of other cool WS-* binding (tooday I use the simpliest one so that my clients like Flash, AJAX, etc connect to me with ease).

I needed Fast and easy in implemrnting connection protocol like one I created fore use with Sockets for real time hi ammount of data transfering.

So.. Any Ideas? Please - I need help.

3
You could write a custom transport in WCF. See this SO question - stackoverflow.com/questions/381142/…Mikael Svenson
I'm not seeing what the problem is with just using WCF. What can't it do that you need it to do?Aaronaught
WCF Is too slow and bugggy for infinit real time hi resolution data transfer over TCP sockets.Rella
Jak: How did you measure that?John Fisher

3 Answers

1
votes

Well if you're going to drop down to pure sockets, you could as well make your service act as proxy. Make WCF Services listen on some other port, and your app on the desired port. When you receive request in your app, manually parse header and check weather it is intended for your service or WCF Service. If it's intended for WCF service, open a TCP connection to WCF service and pass the received data to it, and then simply pass back WCF's answer to the client..

On the other hand you could speed up WCF quite a lot by writing your own custom binding. Lots of time WCF looses on serialization that is done using reflection (which is slow), going around this would improve your speed considerably.

0
votes

If your problem with WCF is performance then you should try the binary net TCP binding to eliminate XML serialization to improve performance.

Some high traffic applications, like realtime games, use UDP for the majority of communication since it cuts through the protocol. With TCP you get ordering and reliability built in, but this comes at the cost of performance because it will implicitly delay packets to wait for out of order packets so that it can hand them to the application in the correct order, or wait for lost packets to be resent. Instead you can use UDP and implement your own scheme for verification of data that is less stringent than TCP.

There are UDP options available for WCF, or you could implement your own. WCF is nothing more than a message pump, and you can replace different steps with whatever you want.

-1
votes

Not sure if this will help you or not, but try turning on your Net TCP Sharing Service.