public class IPSocket
extends java.lang.Object
Modifier and Type | Field and Description |
---|---|
java.io.InputStream |
rawIn |
java.io.OutputStream |
rawOut |
Constructor and Description |
---|
IPSocket(MC68000Cpu cpu,
java.util.HashMap<java.lang.Integer,IPSocket> socketMap)
Create a socket.
|
Modifier and Type | Method and Description |
---|---|
int |
bind(MC68000Cpu cpu)
Binds a socket.
|
void |
close()
Close the socket and all associated channels.
|
int |
connect(MC68000Cpu cpu)
Connects an existing socket.
|
IPTypes.CONN_STATUS |
getConnectionStatus()
Gets the connection status.
|
int |
getLastError()
Gets the last error from the socket.
|
java.lang.String |
getName()
Gets the name of the current socket, including address, port and connection status.
|
int |
getRemote(MC68000Cpu cpu)
Get info on the remote host, put it at (a1)..
|
java.lang.String |
getRemoteChanName() |
java.net.ServerSocket |
getServerSocket()
Get the TCP server socket.
|
java.net.Socket |
getSocket()
Get the TCP client socket.
|
int |
getSocketType()
Get the socket type.
|
int |
listen(MC68000Cpu cpu)
Makes an existing socket a "listening" one.
.
|
int |
receive(MC68000Cpu cpu,
int size,
boolean checkD1,
byte[] byt)
Receive bytes from the port and copy them to (A1), updating A1.
|
int |
receive1Byte(MC68000Cpu cpu,
byte[] byt)
Receive one byte from the port and return it.
|
int |
send(MC68000Cpu cpu,
int size)
Send bytes out over the port.
|
int |
send1Byte(MC68000Cpu cpu,
int byt)
Send one byte out over the socket.
|
int |
sendTo(MC68000Cpu cpu,
int size)
Sendto - only allowed for TCP where it is the same as send.
|
void |
setConnectionStatus(IPTypes.CONN_STATUS g)
Sets the connection status.
|
void |
setLastError(int err)
Gets the last error from the socket.
|
void |
setSocketType(int g)
Sets the socket type.
|
public IPSocket(MC68000Cpu cpu, java.util.HashMap<java.lang.Integer,IPSocket> socketMap)
cpu
- the cpu used.socketMap
- the map with all open sockets.public void close()
public IPTypes.CONN_STATUS getConnectionStatus()
public void setConnectionStatus(IPTypes.CONN_STATUS g)
g
- the connection status wished, one of IPTypes.CONN_STATUS.public int getSocketType()
public void setSocketType(int g)
g
- the type of socket this should be SOCKET_TYPE {SCK,TCP,UDP,NONE}public java.net.Socket getSocket()
public java.net.ServerSocket getServerSocket()
public int getLastError()
public void setLastError(int err)
err
- the last error encountered by the socket when send/receiving,connecting/listening.public int bind(MC68000Cpu cpu)
cpu
- the smsqmulator.cpu.MC68000Cpu object.public int connect(MC68000Cpu cpu)
cpu
- the smsqmulator.cpu.MC68000Cpu (A1 points to a sockaddr structure)public int listen(MC68000Cpu cpu)
cpu
- (a1 points to a sockaddr structure)public int send(MC68000Cpu cpu, int size)
cpu
- the cpu to get data to be sent from, it lies at (A1), ndr of bytes to be sent in D2.L.size
- nbr of bytes to sendpublic int sendTo(MC68000Cpu cpu, int size)
cpu
- the cpu used.size
- size of data to be set, in bytes.public int send1Byte(MC68000Cpu cpu, int byt)
cpu
- the cpu usedbyt
- the byte to sendpublic int receive(MC68000Cpu cpu, int size, boolean checkD1, byte[] byt)
cpu
- the CPU used.size
- nbr of bytes to readcheckD1
- if true, should check D1 for flags.byt
- byt array into which to receive, if null, a temporary one will be used here.public int receive1Byte(MC68000Cpu cpu, byte[] byt)
cpu
- the CPU used.byt
- a byte array with ONE ELEMENT ONLY into which the byte goes, may not be null.public int getRemote(MC68000Cpu cpu)
cpu
- the cpu usedpublic java.lang.String getRemoteChanName()
public java.lang.String getName()