Netduino home hardware projects downloads community

Jump to content


The Netduino forums have been replaced by new forums at community.wildernesslabs.co. This site has been preserved for archival purposes only and the ability to make new accounts or posts has been turned off.
Photo

how to stop the socket.connection


  • Please log in to reply
3 replies to this topic

#1 henryyao

henryyao

    Member

  • Members
  • PipPip
  • 19 posts

Posted 05 February 2013 - 04:24 AM

the socket.connection() really disturbs me thesedays. The program will stuck at socket.connection() forever if the remote port cannot be accessed.

 

So is there a way to solve that, say give it a 5 secs timeout?

 

Is there a way to do that despite the thread.abort()?

 

And  since my socket is a tcp/ip stream socket, and there is a shake hands procedure when the connection is being setup. normally it will try the syn/ack procedure for 21 secs before timeout but somehow it takes much more than that in netduino. 

That's my another confusion.

 

thanks for any comment



#2 NooM

NooM

    Advanced Member

  • Members
  • PipPipPip
  • 490 posts
  • LocationAustria

Posted 06 February 2013 - 09:46 AM

i am not sure about 4.3, but in 4.2 its blocking - means nothing happens till a connection is etablished.

 

you may want to put it in a thread so your programm keeps running, same for receiving data



#3 henryyao

henryyao

    Member

  • Members
  • PipPip
  • 19 posts

Posted 06 February 2013 - 07:04 PM

Ya, I'm using 4.2. Now i'm looking for a better solution rather than multi- thread. I've been searching for a week but cannot find one..

i am not sure about 4.3, but in 4.2 its blocking - means nothing happens till a connection is etablished.

 

you may want to put it in a thread so your programm keeps running, same for receiving data



#4 NooM

NooM

    Advanced Member

  • Members
  • PipPipPip
  • 490 posts
  • LocationAustria

Posted 06 February 2013 - 10:52 PM

netmf doesent support async, so threading _IS_ the best solution.

on windows async would be the best (well, even that is some kind of threading ...)






0 user(s) are reading this topic

0 members, 0 guests, 0 anonymous users

home    hardware    projects    downloads    community    where to buy    contact Copyright © 2016 Wilderness Labs Inc.  |  Legal   |   CC BY-SA
This webpage is licensed under a Creative Commons Attribution-ShareAlike License.