This discussion has been locked.
You can no longer post new replies to this discussion. If you have a question you can start a new discussion

CMSIS network library

Hello Everyone,

Can i get a example code or sample code on the TCP server using the CMSIS network library

Parents
  • 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.

Reply
  • 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.

Children
  • 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.