public class InterProcessComm_SocketImpl extends java.lang.Object implements InterProcessComm
| Modifier and Type | Field and Description |
|---|---|
private static int |
kDataBufferSize |
private Address_InterProcessComm_Socket |
ownAddress |
private java.lang.String |
sRxErrorMsg |
private java.lang.String |
sTxErrorMsg |
private java.net.DatagramSocket |
udpSocket
The UDP Socket handling as receiver
|
receiverShouldbeBlocking, receiverShouldbePolling, version| Constructor and Description |
|---|
InterProcessComm_SocketImpl(Address_InterProcessComm ownAddress) |
| Modifier and Type | Method and Description |
|---|---|
int |
abortReceive()
Abort receiving function
|
int |
capacityToSendWithoutBlocking(int nrofBytesToSend)
Tests wether a next send is done without blocking.
|
int |
checkConnection()
Checks the connection.
|
int |
close()
Closes the mailbox, only to be called on shutdown of the application.
|
Address_InterProcessComm |
createAddress()
Creates an empty instance for a address information, especially for the sender.
|
Address_InterProcessComm |
createAddress(int p1,
int p2) |
Address_InterProcessComm |
createAddress(java.lang.String address) |
Address_InterProcessComm |
createAddress(java.lang.String p1,
int p2) |
int |
dataAvailable()
Tests wether data are available to receive.
|
boolean |
equals(Address_InterProcessComm address1,
Address_InterProcessComm address2)
Compare the address to another address, returns true if it is the same address.
|
int |
flush()
Flushs send data to destination.
|
void |
freeData(byte[] data)
Relinguishes the data buffer, after it is evaluated.
|
java.lang.String |
getName() |
Address_InterProcessComm |
getOwnAddress()
Gets the own address of this interProcessComm, it are the receive parameters.
|
java.lang.String |
getReceiveErrorMsg(boolean clearIt) |
byte[] |
getSendBuffer(int len)
Gets a buffer for send.
|
java.lang.String |
getSendErrorMsg(boolean clearIt) |
int |
open(Address_InterProcessComm dstAddress,
boolean shouldBlock)
Opens the Communication.
|
byte[] |
receive(int[] result,
Address_InterProcessComm senderP)
Receives a Datagram.
|
byte[] |
receiveData(int[] result,
byte[] bufferP,
Address_InterProcessComm senderP) |
int |
send(byte[] data,
int nBytes,
Address_InterProcessComm addresseeP)
Sends Data.
|
java.lang.String |
translateErrorMsg(int nError) |
private static final int kDataBufferSize
private final Address_InterProcessComm_Socket ownAddress
private java.net.DatagramSocket udpSocket
private java.lang.String sRxErrorMsg
private java.lang.String sTxErrorMsg
public InterProcessComm_SocketImpl(Address_InterProcessComm ownAddress)
public int open(Address_InterProcessComm dstAddress, boolean shouldBlock)
InterProcessCommopen in interface InterProcessCommdstAddress - The own address to which this interprocess-port is assigned.
This address is also used
when calling send() as information about the sender of the data.public int close()
InterProcessCommclose in interface InterProcessCommpublic int send(byte[] data,
int nBytes,
Address_InterProcessComm addresseeP)
InterProcessCommsend in interface InterProcessCommdata - The data to be sent. The user should not touch the buffer after calling here.nBytes - The number of bytes to be send.addresseeP - The addressee, the receiver of the message. If it is a fix connection (TCP),
then this parameter should be null. It isn't used. The addressee is given
on #open(Address_InterProcessComm, int)-request.public byte[] receive(int[] result,
Address_InterProcessComm senderP)
InterProcessCommreceive in interface InterProcessCommresult - result[0] = Nr of Bytes sendet, if >=0. If <0 its an error code.senderP - Buffer for the sender of the message.public void freeData(byte[] data)
InterProcessCommfreeData in interface InterProcessCommdata - The buffer delivered from receive!public boolean equals(Address_InterProcessComm address1, Address_InterProcessComm address2)
InterProcessCommequals in interface InterProcessCommpublic java.lang.String getReceiveErrorMsg(boolean clearIt)
public java.lang.String getSendErrorMsg(boolean clearIt)
public int abortReceive()
InterProcessCommabortReceive in interface InterProcessCommpublic int capacityToSendWithoutBlocking(int nrofBytesToSend)
InterProcessCommcapacityToSendWithoutBlocking in interface InterProcessCommpublic int checkConnection()
InterProcessCommcheckConnection in interface InterProcessCommpublic int dataAvailable()
InterProcessCommdataAvailable in interface InterProcessCommpublic int flush()
InterProcessCommflush in interface InterProcessCommpublic java.lang.String getName()
getName in interface InterProcessCommpublic Address_InterProcessComm getOwnAddress()
InterProcessCommgetOwnAddress in interface InterProcessCommpublic byte[] getSendBuffer(int len)
InterProcessCommgetSendBuffer in interface InterProcessCommpublic byte[] receiveData(int[] result,
byte[] bufferP,
Address_InterProcessComm senderP)
receiveData in interface InterProcessCommpublic java.lang.String translateErrorMsg(int nError)
translateErrorMsg in interface InterProcessCommpublic Address_InterProcessComm createAddress()
InterProcessCommcreateAddress in interface InterProcessCommpublic Address_InterProcessComm createAddress(int p1, int p2)
createAddress in interface InterProcessCommpublic Address_InterProcessComm createAddress(java.lang.String p1, int p2)
createAddress in interface InterProcessCommpublic Address_InterProcessComm createAddress(java.lang.String address)
createAddress in interface InterProcessComm