crotwell / seisFile

A library for reading and writing seismic file formats in java.
GNU Lesser General Public License v3.0
27 stars 20 forks source link

SeedlinkReader timeout not working? #30

Closed xspanger3770 closed 1 year ago

xspanger3770 commented 1 year ago

When running

SeedlinkReader reader = new SeedlinkReader("rtweb.units.it", 18000, 10, false);

With a seedlink host that for some reason takes long time to respond (for me it's rtweb.units.it), the timeout of 10 seconds I tried doesn't seem to work

Expected behavior

Code that finishes execution after the 10 seconds with an error if the host is not responding

Actual behavior

Code executes for much longer time (over 2 minutes) before timeout occurs

Am I missing something?

crotwell commented 1 year ago

The current implementation only sets the "read" timeout, which is separate from the initial connection timeout. In other words, no data has arrived within the timeout period, but after a successful connection has been established.

It would probably be worth also allowing the initial connection timeout to be set as well. I will add that in the next version.

crotwell commented 1 year ago

fix in https://github.com/crotwell/seisFile/commit/6b211f1602bdc09372c209ee2d657712260809c7

xspanger3770 commented 1 year ago

Thanks!