Skip to content

Added HttpTimeout#293

Open
jespertheend wants to merge 5 commits intosta:masterfrom
jespertheend:master
Open

Added HttpTimeout#293
jespertheend wants to merge 5 commits intosta:masterfrom
jespertheend:master

Conversation

@jespertheend
Copy link
Copy Markdown

@jespertheend jespertheend commented Sep 6, 2016

I needed a way to shorten the time the client waits before timing out. I could have hard coded it but I figured I might as well add a pull request.

This pull request adds TimeSpan HttpTimeout to the WebSocket class that you can set in order to modify the default 90 seconds.

Jesper added 2 commits September 7, 2016 00:39
Added an option to modify the default 90 seconds that the client waits
before timing out when connecting to a server.
@jespertheend
Copy link
Copy Markdown
Author

Hmm, setting it to 10 seconds doesn't seem to fix my issue.
The problem I'm having is that if a server is closed the WebSocket.Connect() method is blocking so my entire application is freezing. I'll see if I have to add anything else to fix it, I think it has something to do with the second http request being done with a 15 second timeout

Jesper added 3 commits September 7, 2016 01:37
This reverts commit 7dde77f.
Added tcpClientWithTimeout (host, port) that takes _tcpTimeout into
account when connecting.
@jespertheend
Copy link
Copy Markdown
Author

Alright I've got something working now. Basically whenever you do new TcpClient(hostname, port) it locks the thread for an uncertain amount of time. I used the answer from here http://stackoverflow.com/questions/17118632/how-to-set-the-timeout-for-a-tcpclient to create the tcpClientWithTimeout method. This basically does the same as new TcpClient except that it uses the value of _tcpTimeout as timeout.

@daef
Copy link
Copy Markdown

daef commented Jul 11, 2017

@jespertheend awesome, I was just reading up on the connection code and found the hardcoded 90secs.

Before writing a patch I came and found yours - hopefully it will be merged soon :)

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

Successfully merging this pull request may close these issues.

2 participants