Issues with socket in stand-by... - Netduino Plus 2 (and Netduino Plus 1) - Netduino Forums
   
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

Issues with socket in stand-by...

socket web server

  • Please log in to reply
3 replies to this topic

#1 Archimede

Archimede

    Member

  • Validating
  • PipPip
  • 15 posts

Posted 30 September 2013 - 12:10 PM

Hi everyone ! :)

I’ve got an issue with my server web socket. An abstract scheme of the socket is: Socket: {

Loop(); // Data acquisition TableUpdate(); // with new data if(userRequest == true)

SendTable(); // sends the table to the web browser

}

 

The point is that, if the user doesn’t send a request for 4-5 seconds Loop() is not run. I need Loop to be executed also if there’s no user request for the socket. It seems that the socket is in stand-by, waiting for a new request. If you want I can write the code. Thank you for your help.



#2 Jason.Net

Jason.Net

    Advanced Member

  • Members
  • PipPipPip
  • 41 posts

Posted 02 October 2013 - 06:03 AM

Hi everyone ! :) I’ve got an issue with my server web socket. An abstract scheme of the socket is: Socket: { Loop(); // Data acquisition TableUpdate(); // with new data if(userRequest == true) SendTable(); // sends the table to the web browser } The point is that, if the user doesn’t send a request for 4-5 seconds Loop() is not run. I need Loop to be executed also if there’s no user request for the socket. It seems that the socket is in stand-by, waiting for a new request. If you want I can write the code. Thank you for your help.

Hi It is hard to tell from your code but I would guess that the socket is blocked listening for an incoming connection. That is why loop only runs when the browser opens a connection. There are examples on this site on how to put blocking code into a thread. Can't search as I'm mobile. Cheers

#3 Archimede

Archimede

    Member

  • Validating
  • PipPip
  • 15 posts

Posted 08 October 2013 - 10:18 AM

Thank you for your answer. I'm looking for examples in this site on how to put blocking code into a thread, but I couldn't find. If you can write a link it would be great.  

The only thing I found in this forum about this issue is that I should use threads, but I've got no experience with threads.

Wish you can help me :) Thank you again...

 

Cheers



#4 Jason.Net

Jason.Net

    Advanced Member

  • Members
  • PipPipPip
  • 41 posts

Posted 08 October 2013 - 03:36 PM

Thank you for your answer. I'm looking for examples in this site on how to put blocking code into a thread, but I couldn't find. If you can write a link it would be great.  

The only thing I found in this forum about this issue is that I should use threads, but I've got no experience with threads.

Wish you can help me :) Thank you again...

 

Cheers

 

 

 

 

Have a look at any or all of these. There is a lot of detail in some of these great projects but the main webservers demonstrate what you need to understand.

Cheers

 

http://embeddedwebserver.codeplex.com/

http://neonmikawebserver.codeplex.com/

http://homelogger.codeplex.com/







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.