public class Sockaddr extends Object
| Constructor and Description |
|---|
Sockaddr()
Use this constructor for creating objects to call
LinuxNativeUtil.recvfrom(int, byte[], int, int, int, Sockaddr)
and similar methods that want to output a socket address. |
Sockaddr(int addressFamily,
byte[] address)
Constructs new native representation of a socket address.
|
Sockaddr(Sockaddr other) |
| Modifier and Type | Method and Description |
|---|---|
Sockaddr |
clone() |
void |
copyTo(Sockaddr other)
Copy this address to the other address object.
|
boolean |
equals(Object o) |
byte[] |
getAddress()
IF you need to store the returned array copy it as it is mutable.
|
int |
getAddressFamily()
Returns the Address family of this socket address in a easy to understand format for java.
|
int |
hashCode() |
InetSocketAddress |
parseWin32_SOCKADDR_INET()
Parses the Sockaddr as a Win32 SOCKADDR_INET.
|
String |
toString() |
public Sockaddr()
LinuxNativeUtil.recvfrom(int, byte[], int, int, int, Sockaddr)
and similar methods that want to output a socket address. Be aware that such syscalls may mutate the address array if the size fits the desired size.
You should in general copy the address array if you need to store it before reusing a Sockaddr Object as an outputpublic Sockaddr(int addressFamily,
byte[] address)
addressFamily - constant address family value. This is the first field within address.address - binary value of the respective struct sockaddr. This must include the addressFamily.
If you construct this value manually then the size must match the native structs size or syscalls using this address may fail because of it.
The size for certain addresses may be dependent on the CPU architecture.public Sockaddr(Sockaddr other)
public int getAddressFamily()
public byte[] getAddress()
public void copyTo(Sockaddr other)
public InetSocketAddress parseWin32_SOCKADDR_INET()
Copyright © 2024. All rights reserved.