284 Star 1.9K Fork 702

GVP於之 / IOTGate

 / 详情

分割字符串获取ip的代码有错误

已完成
创建于  
2020-06-09 19:36

代码
Client2Master#loginGateHeader

		byte[] bs = Inet4Address.getByName(ipAddress.split("|")[0]).getAddress();//127.0.0.1 -->  [127, 0, 0, 1]
		headBuf.writeInt8(bs[0]);
		headBuf.writeInt8(bs[1]);
		headBuf.writeInt8(bs[2]);
		headBuf.writeInt8(bs[3]);
		headBuf.writeInt16(Integer.parseInt(ipAddress.split("|")[1]));//port  两个字节表示端口号
		headBuf.writeInt32(count);//count  4个字节的count

split方法的参数是正则表达式,应该写成:ipAddress.split("\\|")

评论 (0)

wayshall 创建了任务
wayshall 关联仓库设置为於之/IOTGate
wayshall 修改了描述
於之 任务状态待办的 修改为进行中
於之 任务状态进行中 修改为已完成
展开全部操作日志

登录 后才可以发表评论

状态
负责人
里程碑
Pull Requests
关联的 Pull Requests 被合并后可能会关闭此 issue
分支
开始日期   -   截止日期
-
置顶选项
优先级
参与者(1)
Java
1
https://gitee.com/willbeahero/IOTGate.git
git@gitee.com:willbeahero/IOTGate.git
willbeahero
IOTGate
IOTGate

搜索帮助