public class NetworkUdpBase extends NetworkBase
| 限定符和类型 | 字段和说明 |
|---|---|
protected SimpleHybirdLock |
simpleHybirdLock |
CoreSocket, fileCacheSize, LogNet, Token| 构造器和说明 |
|---|
NetworkUdpBase()
默认的无参的构造方法
|
| 限定符和类型 | 方法和说明 |
|---|---|
String |
getConnectionId()
当前连接的唯一ID号,默认为长度20的guid码加随机数组成,也可以自己指定
|
String |
getIpAddress()
获取远程服务器的IP地址,如果是本机测试,那么需要设置为127.0.0.1
Get the IP address of the remote server. |
int |
getPort()
获取服务器的端口号,具体的值需要取决于对方的配置
Gets the port number of the server. |
int |
getReceiveCacheLength()
获取一次接收时的数据长度,默认2KB数据长度,特殊情况的时候需要调整
Gets the length of data received at a time. |
int |
getReceiveTimeOut()
获取接收服务器反馈的时间,如果为负数,则不接收反馈
Gets the time to receive server feedback, and if it is a negative number, does not receive feedback |
protected byte[] |
PackCommandWithHeader(byte[] command)
对当前的命令进行打包处理,通常是携带命令头内容,标记当前的命令的长度信息,需要进行重写,否则默认不打包
|
OperateResultExOne<byte[]> |
ReadFromCoreServer(byte[] send)
核心的数据交互读取,发数据发送到通道上去,然后从通道上接收返回的数据
|
OperateResultExOne<byte[]> |
ReadFromCoreServer(byte[] send,
boolean hasResponseData,
boolean usePackAndUnpack)
核心的数据交互读取,发数据发送到通道上去,然后从通道上接收返回的数据
|
void |
setConnectionId(String connectionId)
当前连接的唯一ID号,默认为长度20的guid码加随机数组成,方便列表管理,也可以自己指定
The unique ID number of the current connection. |
void |
setIpAddress(String ipAddress)
设置远程服务器的IP地址,如果是本机测试,那么需要设置为127.0.0.1
Set the IP address of the remote server. |
void |
setPort(int port)
设置服务器的端口号,具体的值需要取决于对方的配置
Sets the port number of the server. |
void |
setReceiveCacheLength(int receiveCacheLength)
设置一次接收时的数据长度,默认2KB数据长度,特殊情况的时候需要调整
Sets the length of data received at a time. |
void |
setReceiveTimeOut(int receiveTimeOut)
设置接收服务器反馈的时间,如果为负数,则不接收反馈
Sets the time to receive server feedback, and if it is a negative number, does not receive feedback |
String |
toString()
返回当前对象表示的字符串
Returns the string represented by the current object |
protected OperateResultExOne<byte[]> |
UnpackResponseContent(byte[] send,
byte[] response)
根据对方返回的报文命令,对命令进行基本的拆包,例如各种Modbus协议拆包为统一的核心报文,还支持对报文的验证
|
CheckRemoteToken, CloseSocket, CreateSocketAndConnect, CreateSocketAndConnect, CreateSocketAndConnect, ReadStream, Receive, Receive, Receive, ReceiveAndCheckBytes, ReceiveByMessage, ReceiveByMessage, ReceiveBytesContentFromSocket, ReceiveBytesContentFromSocket, ReceiveCommandLineFromSocket, ReceiveCommandLineFromSocket, ReceiveCommandLineFromSocket, ReceiveCommandLineFromSocket, ReceiveFrameWebSocketPayload, ReceiveHslMessage, ReceiveMqttMessage, ReceiveRedisCommand, ReceiveRedisCommandString, ReceiveStringArrayContentFromSocket, ReceiveStringArrayContentFromSocket, ReceiveStringContentFromSocket, ReceiveStringContentFromSocket, ReceiveWebSocketPayload, Send, Send, SendAccountAndCheckReceive, SendBaseAndCheckReceive, SendBytesAndCheckReceive, SendStreamToSocket, SendStringAndCheckReceive, SendStringAndCheckReceive, ThreadPoolCheckTimeOut, WriteStream, WriteStreamFromSocketprotected SimpleHybirdLock simpleHybirdLock
public String getIpAddress()
public void setIpAddress(String ipAddress)
ipAddress - IP地址public int getPort()
public void setPort(int port)
port - 端口号public int getReceiveTimeOut()
public void setReceiveTimeOut(int receiveTimeOut)
receiveTimeOut - 数值public String getConnectionId()
public void setConnectionId(String connectionId)
connectionId - 连接的id信息public int getReceiveCacheLength()
public void setReceiveCacheLength(int receiveCacheLength)
receiveCacheLength - 长度大小信息protected byte[] PackCommandWithHeader(byte[] command)
command - 发送的数据命令内容protected OperateResultExOne<byte[]> UnpackResponseContent(byte[] send, byte[] response)
send - 发送的原始报文数据response - 设备方反馈的原始报文内容public OperateResultExOne<byte[]> ReadFromCoreServer(byte[] send)
send - 完整的报文内容public OperateResultExOne<byte[]> ReadFromCoreServer(byte[] send, boolean hasResponseData, boolean usePackAndUnpack)
send - 完整的报文内容hasResponseData - 是否有等待的数据返回usePackAndUnpack - 是否需要对命令重新打包public String toString()
NetworkBasetoString 在类中 NetworkBaseCopyright © 2022. All rights reserved.