Reputation: 15726
I am experimenting with nanomsg.
Is it possible to connect to a nanomsg socket from a client using .NET's Socket class or for that matter, any other socket library other than another nanomsg client?
Are there any online tutorials and/or examples about doing this?
For example, using nanocat, bind a socket to a port. Then from C# .NET attempt to connect to the socket:
Socket s = new Socket(AddressFamily.InterNetwork, SocketType.Raw, ProtocolType.Raw);
s.Connect("127.0.0.1", 1234);
Upvotes: 2
Views: 2016
Reputation: 70671
Sockets are sockets. They abstract network protocols, like TCP and UDP, and send bytes back and forth.
So yes, you can use Socket
to connect to any other remote endpoint using TCP, even if that endpoint isn't even using sockets as their implementation.
Of course, you still have to be able to interpret the bytes. But that's not the job of the Socket
class. It's only there to provide the connection and byte-based I/O.
If you are asking about dealing with the nanomsg protocol specifically, it seems as though there's already a .NET library for nanomsg. Looking at the documentation, it seems to me that it's a fairly elaborate protocol, including a distributed communications protocol. I would think you'd be much better off using the existing library instead of reimplementing all that.
Upvotes: 4