What is the C#.NET equivalent for java SocketAddress and ByteBuffe

G

Guest

Hi,

for porting java to c# i need to know:
What is the C#.NET equivalent for java.net.SocketAddress and
java.nio.ByteBuffer ?

Thanks.
 
N

Nicholas Paldino [.NET/C# MVP]

Yaron,

The .NET equivalent for SocketAddress would be EndPoint. For an IP
address (in Java, it is InetSocketAddress), you can use the IPEndPoint
class. In .NET, it is a little different, as you can't use a DNS name (you
can use the static methods on the DNS class to resolve a dns name into an IP
address), just an IP address.

For the ByteBuffer class, there is no direct equivalent. I would
recomment you use a MemoryStream instance (for the backing store), along
with a BinaryReader/BinaryWriter class to read/write primitive data types
to/from the stream.

Hope this helps.
 
G

Guest

Thanks a lot.


Nicholas Paldino said:
Yaron,

The .NET equivalent for SocketAddress would be EndPoint. For an IP
address (in Java, it is InetSocketAddress), you can use the IPEndPoint
class. In .NET, it is a little different, as you can't use a DNS name (you
can use the static methods on the DNS class to resolve a dns name into an IP
address), just an IP address.

For the ByteBuffer class, there is no direct equivalent. I would
recomment you use a MemoryStream instance (for the backing store), along
with a BinaryReader/BinaryWriter class to read/write primitive data types
to/from the stream.

Hope this helps.


--
- Nicholas Paldino [.NET/C# MVP]
- (e-mail address removed)

yaron said:
Hi,

for porting java to c# i need to know:
What is the C#.NET equivalent for java.net.SocketAddress and
java.nio.ByteBuffer ?

Thanks.
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top