Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

writeAndFlush lost packet but operationComplete is true #4915

Closed
windpiger opened this issue Feb 29, 2016 · 2 comments
Closed

writeAndFlush lost packet but operationComplete is true #4915

windpiger opened this issue Feb 29, 2016 · 2 comments

Comments

@windpiger
Copy link

I use keep-alive tcp connect between client and server, but when the client re-connect to the server, during the re-connect time,the server do not receive the packet from the client ,but the client operationComplete is true, how does it happen? operationComplete method called does not mean the packet has successfully send to the server?

channel.writeAndFlush(msg).addListener(new ChannelFutureListener() {
override def operationComplete(future: ChannelFuture): Unit = future.isSuccess match {
case true =>
logInfo(s"successfully send msg to Server")
case _ =>
logError(s"fail send msg to Server)
}
}

@Scottmitch
Copy link
Member

operationComplete method called does not mean the packet has successfully send to the server?

The future should complete when msg has been flushed to the underlying OS, or if a failure occurred before this could happen.

during the re-connect time

The sequence of events is not clear. Can you clarify and/or provide a reproducer? For example which peer initiates a close, if/when does the other peer receive a channelInactive, and which socket is being used to send the data that is not being received as expected (the one before close, or a new one where you have received a channelActive for).

@normanmaurer
Copy link
Member

@windpiger the future is notified once the syscall success. This not means that it was transmitted and received by the remote peer. For this you will need to implement some kind of acknowledge into your protocol.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

3 participants