Hello,
Ok so I am trying to figure out how I can Open a TCP connection (listen()) and accept the connection without blocking the rest of my code, so if there is no connection present it will continue to do its data processing and when a connection appears it will service that connection with its requests, etc. I would prefer to use the task programming method, creating a task to handle the TCP connection, but I am new to embedded design and only familiar with sequential programming. So I was attempting to have an conditional test for a connection to service else continue with the main loop but it gets held up at the accept function. If I do make it in another task do I use Flags? Is there a TCP flag that will get triggered when a connection happens and that can Post the task?
Two more questions if you'll be so gracious, what does accept() return? And how does select() work?
Thank you for your time and assistance, it is greatly appreciated.
Understanding TCP
-
- Posts: 513
- Joined: Sat Apr 26, 2008 7:14 am
Re: Understanding TCP
There is some discussion and well-comented explanation in the NNDK programmers Manual:
C:\Nburn\docs\NetworkProgrammersGuide, in particular see Sections 12.2.1 to 2.2.4
In additon, select(), accept(), listen(), etc. are described in
C:\Nburn\docs\NetBurnerRuntimeLibrary\NetBurnerRuntimeLibraries.pdf
Finallly, don't forget the example code:
C:\Nburn\examples\TCP, and in particular the TcpServerSelect folder.
C:\Nburn\docs\NetworkProgrammersGuide, in particular see Sections 12.2.1 to 2.2.4
In additon, select(), accept(), listen(), etc. are described in
C:\Nburn\docs\NetBurnerRuntimeLibrary\NetBurnerRuntimeLibraries.pdf
Finallly, don't forget the example code:
C:\Nburn\examples\TCP, and in particular the TcpServerSelect folder.
-
- Posts: 513
- Joined: Sat Apr 26, 2008 7:14 am
Re: Understanding TCP
Forgot to add:
If you need more fundamental TCP background info, the bible is TCP/IP Illustrated by W. Richard Stevens Volume 1 (of 3) in particular. It won't tell you about tasks, or uc/OS concepts though. See:
C:\Nburn\docs\NetBurnerRuntimeLibrary\uCOSLibrary.pdf for that.
If you need more fundamental TCP background info, the bible is TCP/IP Illustrated by W. Richard Stevens Volume 1 (of 3) in particular. It won't tell you about tasks, or uc/OS concepts though. See:
C:\Nburn\docs\NetBurnerRuntimeLibrary\uCOSLibrary.pdf for that.
Re: Understanding TCP
Thank you very much. I was using google to try and decipher the functions and it wasn't quite right.
Re: Understanding TCP
Oh I don't have this
"Finallly, don't forget the example code:
C:\Nburn\examples\TCP, and in particular the TcpServerSelect folder."
There is no TCP director, I have other TCP examples that I am using to figure out how it works, but not this particular one. Im working with the TCP2Serial example and the Telnet example
"Finallly, don't forget the example code:
C:\Nburn\examples\TCP, and in particular the TcpServerSelect folder."
There is no TCP director, I have other TCP examples that I am using to figure out how it works, but not this particular one. Im working with the TCP2Serial example and the Telnet example
-
- Posts: 513
- Joined: Sat Apr 26, 2008 7:14 am
Re: Understanding TCP
What NB release are you running? Sounds like you may be running a pretty old distribution. To find out, open the file C:\nburn\release_tag with a text editor. The current relaes is Rel23_rc7a
The C:\Nburn\examples\TCP\TcpServerSelect example folder (along with several other TCP examples) have been a part of the distribution for at least a year, since at least NNDK2.2 RC2.
The updated versions are worthwhile and highly recommended.
The C:\Nburn\examples\TCP\TcpServerSelect example folder (along with several other TCP examples) have been a part of the distribution for at least a year, since at least NNDK2.2 RC2.
The updated versions are worthwhile and highly recommended.
Re: Understanding TCP
I would agree with everything posted by ridgeglider, and would like to add:
- Definitely read at least the first 25 pages of the stevens book. It will save you hours of time later on.
- Start small and experiment topic by topic. Use lots of iprintf() status messages to see what is going on. Some developers frown on this, but you can leave these messages in and get a lot of good information as you develop your application.
- There is a definite learning curve to embedded programming and network communications. You are doing both at the same time. Be patient and realize you are tackling a lot at one time.
- Definitely read at least the first 25 pages of the stevens book. It will save you hours of time later on.
- Start small and experiment topic by topic. Use lots of iprintf() status messages to see what is going on. Some developers frown on this, but you can leave these messages in and get a lot of good information as you develop your application.
- There is a definite learning curve to embedded programming and network communications. You are doing both at the same time. Be patient and realize you are tackling a lot at one time.
Re: Understanding TCP
Hello again,
Well i have some moderate sucess, i was able to get my Mod5282 talking to a modbus master!!!
Now im working on interactive webserver for remote settings changing and am trying to go through the example in for the iadweb (section 9.5 in the Netburner Programmers Guide). As i mentioned earlier I didn't have these source codes, so I got them off the webpage. I created a new project and imported the three c files and now the console tells me "Nothing to Build"
Any clue why im getting this error?
Thanks again, you are all very helpful!!
PS. My company got the product back in May, 2008.
Well i have some moderate sucess, i was able to get my Mod5282 talking to a modbus master!!!
Now im working on interactive webserver for remote settings changing and am trying to go through the example in for the iadweb (section 9.5 in the Netburner Programmers Guide). As i mentioned earlier I didn't have these source codes, so I got them off the webpage. I created a new project and imported the three c files and now the console tells me "Nothing to Build"
Any clue why im getting this error?
Thanks again, you are all very helpful!!
PS. My company got the product back in May, 2008.
Re: Understanding TCP
Follow this NetBurner video carefully, I think it should get around the problem, using the tictactoe example c files imported.noob wrote:
I created a new project and imported the three c files and now the console tells me "Nothing to Build"
http://www.netburner.com/video/importin ... rting.html
Best wishes
Paul
http://www.microwebserver.net