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

Socket exception


  • Please log in to reply
5 replies to this topic

#1 Ellen

Ellen

    Advanced Member

  • Members
  • PipPipPip
  • 65 posts
  • LocationRotterdam, Netherlands

Posted 04 October 2012 - 09:50 AM

Hello You all,
I have copy and paste a code snippet example of a N+ server and change it a bit for own use.

We use portForwarding in the router.

When I execute this code and use the browser with a intern address 192.168.1.55:66777/ledon then the code works perfect.

But when I execute the code and use the browser with my extern ip address [IPADDRESS]:66777/ledon then I must 2 times enter the browser, the code will then execute but after I get a error exception in the code: Using socketConnection As Socket = socketServer.Accept()

When I change .Poll(-1, ... In .Poll(50000,... then it works perfect.

Now my question:
I do not know why I get an error and what's the difference between, Is there any difference in handling local and external calls?
Thank You Ellen.


Using socketServer = New Socket(AddressFamily.InterNetwork, SocketType.Stream, ProtocolType.Tcp)    
   socketServer.Bind(New IPEndPoint(IPAddress.Any, intPort))
   socketServer.Listen(1)

   While True
 
     Try

         Using socketConnection As Socket = socketServer.Accept()

            If socketConnection.Poll(-1, SelectMode.SelectRead) Then


#2 supra

supra

    Advanced Member

  • Members
  • PipPipPip
  • 210 posts
  • LocationOntario, Canada

Posted 04 October 2012 - 01:07 PM

here is link:
Mylink

#3 Ellen

Ellen

    Advanced Member

  • Members
  • PipPipPip
  • 65 posts
  • LocationRotterdam, Netherlands

Posted 04 October 2012 - 03:27 PM

here is link:
Mylink

Hello Supra, thank you for the link. I had already read the MSDN description of Poll. But can you answer my question why Poll(-1 methode do not work and generates an error when the N+ has a external request? Is it maybe a anomalistic behavior?
Ellen

#4 supra

supra

    Advanced Member

  • Members
  • PipPipPip
  • 210 posts
  • LocationOntario, Canada

Posted 04 October 2012 - 07:16 PM

Hello Supra, thank you for the link. I had already read the MSDN description of Poll. But can you answer my question why Poll(-1 methode do not work and generates an error when the N+ has a external request? Is it maybe a anomalistic behavior?
Ellen




Sorry tag code doesn't work probably

#5 supra

supra

    Advanced Member

  • Members
  • PipPipPip
  • 210 posts
  • LocationOntario, Canada

Posted 04 October 2012 - 07:38 PM

try this:

Using socketServer = New Socket(AddressFamily.InterNetwork, SocketType.SDgram, ProtocolType.Udp)


#6 Nicky

Nicky

    Advanced Member

  • Members
  • PipPipPip
  • 78 posts
  • LocationDenmark

Posted 04 October 2012 - 08:28 PM

It's a long shot, but try change socketServer.Listen(1); to a higher number..

ntools
TCP Listener (Beta) · FTP Server (Alpha)
Netduino Plus Go Module · Xml Parser
http://ntools.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.