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

How to Read data unblock? #12

Open
zhougb3 opened this issue Mar 8, 2019 · 1 comment
Open

How to Read data unblock? #12

zhougb3 opened this issue Mar 8, 2019 · 1 comment

Comments

@zhougb3
Copy link

zhougb3 commented Mar 8, 2019

Now I use telnet.DialTo to get a conn.I use this conn to Read bytes using the function conn.Read().However,it is blocked.How can I solve this problem,thank you! Idon't know how many bytes i will receive.ButI want to receive all of them

@calvincramer
Copy link

I did some testing on this problem. I was using an expect library on top of the telnet connection. The issue I saw was that the reiver telnet connection would block forever until all bytes are available.

I solved this using a different telnet library https://pkg.go.dev/github.com/ziutek/telnet

I tested ziutek's library by making a simple telnet server that just sends a simple message when clients connect, and could see on Read() with zuitek any unavailable bytes will be set to 0 (eager read), while the reiver connection will block.

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

No branches or pull requests

2 participants