I have a TCP based service I would like to expose through WCF. The service API is similar to the TcpListener
class (actually is based on it), accepts TCP connections as clients and sends and receive raw Stream
derived objects through the client class. I would like to create a WCF wrapper that allow to send and receive objects, by taking advantage of WCF serialization.
The basic contract only contains two operations, send and receive, and the formatting usually would be schemaless like JSON, but the client can specify a protocol on connection, so I would like to be ready to accept some of them.
It should work also with SSL. At the moment, when I have to work with SSL I have to wrap the TcpClient.GetStream()
in a SslStream
but the peformance is very poor. I would like to use my service without this hack, and use the WCF SSL by doing something like:
<binding name="MyBinding">
<security mode="Transport">
<transport clientCredentialType="Windows" />
</security>
</binding>
These are my doubts so far:
What do I need to create? A custom transport or custom binding?
Is there anything special I should implement to allow WCF track/manage the lifetime of my service or client connections?
Cheers.