Hello Everyone,
Can i get a example code or sample code on the TCP server using the CMSIS network library
You seem to mix and match information a lot in your posts, making it almost impossible to understand what you want to say.
- In one post, you talk about the need for having a DHCP server. - In one post, you talk about issues setting a fixed IP. - In your latest post, you talk about using a DHCP client while suddenly talking about a DHCP server again.
You talk about "Because i used DHCP server implementation by making the DHCP enable" while linking to a page that has an enable flag for DHCP client.
Your "this didn't work as mentioned" should probably be rewritten as "this didn't work as I incorrectly assumed it should work."
No library of any significant size is bug free. And "fully tested" is also quite problematic since the earth can't supply the electric current to do a full test of many significantly large programs/libraries.
But don't start to assume you suffer from bugs in the library, until you have managed to understand what the library is actually intended to do.
Hello Per Westermark,
Thanks for correcting me.
Can i know how you implemented DHCP server.
Can i know which version of the network library are referring to ?
To be a little bit rude: It would help if you decide to read the answers you receive.
See this thread (your own - related specifically to the need for a DHCP server): http://www.keil.com/forum/61808/
The answer you received from Keil was: "Network library does not support a DHCP server. You will have to implement the service on your own."
After having received this answer, you directly jumped to a completely different question - not related to DHCP server but suddenly to how to set a fixed IP on your side (which the networking suit can do):
Hi Franc Urbanc, Thank you for replying, Network library will not support DHCP server implementation correct. whether is it possible to fixed the one IP address permanently to the board(evaluation board) using network library ?"
You further wrote:
you told that Network library will not Support the DHCP server implementation. 1. can i know when the new patch or pack of network library with the working DHCP server implementation will be release ?
Which would imply that you think Franc Urbanc said there is a DHCP server - but broken - after which you wanted to know when it would be fixed.
So you once more got the answer:
Unfortunatelly DHCP server and packet router are not supported in Network library.
Nothing there, indicating that Keil sees it as a prioritized task to add a DHCP server - the people who do know how to write a router would normally have the skills to write a DHCP server. And the rest of Keil's customers do not need a DHCP server, since the huge majority of embedded devices have an interface to set a fixed IP or expects the network to supply the DHCP server.
So in the end, it comes down to this: Do you have the skills to write a DHCP server? And if you implement a router - do you have the skills to look at port forwarding, network address translations etc that would be standard functionality of a router. Remember that your device isn't just tunneling all data - you claimed that the PC behind the router should share the same connection as your embedded program used. So you need to have two external IP, or look at protocols and ports, VLAN tagging etc to decide what data that should be forwarded to the PC and what should be handled by the embedded application.
How I implemented a DHCP server using the Keil networking suite? I have never had a reason to use the Keil networking suite to implement any DHCP server. When I need router functionality, I go all the way to Linux-based solutions. Besides a DHCP server, I then also get iptables/nftables, QoS, IPsec, easy remote, modular, firmware updates, a web server that can run PHP, ...
Thank you for your detailed response.
Actually for the first time i'm working on the router development, so i don't have any idea about how to develop a router code.
i think before developing the code, i need learn about how the network protocol works. how IP addresses are assigned, what frames has to sent first to request the other device to connect. etc..
There are lots of documentation about the DHCP protocol on the net. And there is also a number of DHCP servers available with reasonably licensed source code available.
So the information needed to implement a DHCP server is available - the challenge is to decide what functionality the server needs to implement and what simplifications that can be acceptable. For example do you support just a single PC or can the user make use of a switch and expect to get IP numbers to 100 different units.
Hi Per Westermark,
The functionality of the server needs to assign a IP address to the client which is given by me, for a period of 1 day and i would like to support only one PC.
Can you share the information about this. It would be a great help.
can i know the steps involved from the scratch to develop or if you can share your implement on this.
Here's something i knocked up a few years ago as a simple test:
#!/usr/bin/env python import socket,traceback host = '192.168.1.111' port = 67 s = socket.socket(socket.AF_INET, socket.SOCK_DGRAM) s.setsockopt(socket.SOL_SOCKET, socket.SO_REUSEADDR, 1) s.setsockopt(socket.SOL_SOCKET, socket.SO_BROADCAST, 1) s.bind((host, port)) while 1: try: message, address = s.recvfrom(8192) print("DHCP Request detected") except (KeyboardInterrupt, SystemExit): raise
With a little work, this could become a useful DHCP server. I'll let you figure out how.
"Can you share the information about this. It would be a great help."
Maybe surprise us and spend a bit of own time on the project? I would not earn any money from spending time supplying you with a DHCP server.
If this is a school project, then you are expected to learn.
If this is a hobby project, then the primary reasons would be because you are interested and want to learn.
If this is a commercial project, they you get paid to do this work.