Answered by:
StreamSocket exception " connection refused by target mechine"

Question
-
Hello all,
am using stream socket to establish connection between client machine and server. When I used the IP address and port number correctly the connection establishing well. But when I tried to establish connection with wrong port number on same IP, it throwing exception like "refused connection by target machine". But am not able to handle that exception, can any one tell me how can I handle this exception??(it is runtime exception, no exception will thrown when i deployed it) ,
Thanks in advance
Wednesday, July 18, 2012 5:32 AM
Answers
-
Can you post a sample of the code you are using?
Jeff Sanders (MSFT)
- Marked as answer by NagendraVivek Thursday, December 13, 2012 5:13 AM
Wednesday, July 25, 2012 1:09 PMModerator
All replies
-
Hi Nagendra,
Use a Try Catch block on your code to catch exceptions.
-Jeff
Jeff Sanders (MSFT)
- Proposed as answer by Jeff SandersMicrosoft employee, Moderator Wednesday, July 18, 2012 2:17 PM
Wednesday, July 18, 2012 2:17 PMModerator -
@jpsanders,No use, I tried it already,my cause: it is run time exception
Wednesday, July 25, 2012 12:53 PM -
Can you post a sample of the code you are using?
Jeff Sanders (MSFT)
- Marked as answer by NagendraVivek Thursday, December 13, 2012 5:13 AM
Wednesday, July 25, 2012 1:09 PMModerator -
@jpsanders very sorry for the very late reply!!
I just tried again that sample with wrong port, now it is firing the error function (onError handler) finely,
thank you
Thursday, December 13, 2012 5:12 AM