-
Notifications
You must be signed in to change notification settings - Fork 10
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
Fix missing error if initial connection cannot be established. #5
base: master
Are you sure you want to change the base?
Conversation
Greetings If I'm not mistaken if the socket is unable to connect it will emit an error event which is transformed and emitted as a 'disconnected' one which can then be used to manually call the close. |
Well, the error is the following: When I set up a connection to an OPC-DA server according to your instructions https://github.com/st-one-io/node-dcom, my example code looks as follows: ` const sessionSingleton = new Session() // start the COM Server In this code, the line I am asking for getting a useful error message if the address is unreachable. My proposed patch here is one solution I could come up with: Upon unreachable IP address, the ComTransport just doesn't return (=resolve), but the usual behaviour is to have a timeout running in parallel. So I added this timeout in ComTransport to let it emit an 'error' signal, upon which the Rpc Stub also throws an error. There might be other solutions possible, of course. My point is that the current code still doesn't handle the unreachable IP address situation and this should be improved. If you already have a different possibility to catch this situation, my request probably asks for documenting this possibility and I'll happily use that. Thanks! |
Greetings
However I made a mistake by not including the error message so you can listen to an event but it will say nothing about what happened. Also the time we'll wait for the socket cannot be changed so your suggestion seems like a good solution . I will play with it a bit and if everything is alright this can be merged. Ty |
E.g. if the IP address of the server is wrong: Currently the socket setup just runs forever, but the situation of a wrong server address should better be handled somehow.
Any news on including this PR here? You mentioned the What else should I provide to you? I submitted a bug description including steps on how to reproduce; I added an example file that directly shows the erroneous behaviour (in PR #8); I submitted a PR here that fixes this. What else do you want to receive? |
Any news on including this PR here? |
Use case: If you try to create a connection to a DCOM server (OPCDA Server in my example), but misspelled the IP address. Currently the socket setup just runs forever, but we already have a timeout setting and also an
error
event which we only have to use.Proposed solution: Add a timer that lets the ComTransport object emit an
error
event if the timeout times out before the socket has connected, otherwise clear the timeout again immediately.