Closed pajkho closed 1 year ago
@pajkho, this is a common issue if you are trying to use the socket while it has not established a connection yet. Make sure you wait for the connection callback before using the socket.
The issue arises for us when having continuous writes to the tcp connection which doesn't stop until the end event happens. If the connection closes there can be a gap between the close of the connection and the end event where there is new writes which causes this error and the app crashes.
Wouldn't it be more reasonable to try/catch this to prevent the app from crashing and instead call the error event? It shouldn't be possible to crash the app because you mistakenly try to write to a closed connection.
@pajkho, indeed, I will release a fix ASAP.
:tada: This issue has been resolved in version 6.0.6 :tada:
The release is available on:
Your semantic-release bot :package::rocket:
Hello, this fix is missing in version 6.1.0 socketMap.remove(cId);
@yang-Ann, this fix is included in the latest version. The solution was to remove socketMap.remove(cId);
.
Thank you very much
------------------ 原始邮件 ------------------ 发件人: "Rodrigo @.>; 发送时间: 2024年7月9日(星期二) 下午5:37 收件人: @.>; 抄送: @.>; @.>; 主题: Re: [Rapsssito/react-native-tcp-socket] java.lang.IllegalArgumentException Tcp Sockets: No socket with id (Issue #167)
@yang-Ann, this fix is included in the latest version. The solution was to remove socketMap.remove(cId);.
— Reply to this email directly, view it on GitHub, or unsubscribe. You are receiving this because you were mentioned.Message ID: @.***>
Description
Sometimes when the connection gets interrupted while writing data the app will crash with "No socket with id" error. I suspect that this might be due to the write method not catching the errors that is thrown by getTcpClient method.
Steps to reproduce
Steps to reproduce the behavior:
Current behavior
App crashes with error
Expected behavior
Connection can close but app should not crash.
Relevant information