Search code examples
udpgprs

UDP configuration in webserver to accept connection from GPRS mobile device


Could someone please help me to configure UDP in web server to accept connection from GPRS mobile device. The GPRS mobile device will send data packets which i need to write as a file in web server to process a web page. Please help.

i need to know the following:

1) How to configure UDP in web server 2) How can a GPRS mobile device get connected to the server using UDP 3) Write the data packets to a txt file

Please help.


Solution

    • A "web server" usually means am "http-server", which is a process listening for incoming "http"-requests. Now http is a protocol that is standardized to be accessed via TCP/IP port 80. Therefore most webserver implementations will implement a TCP/IP server that listens to port 80 by default. Usually you can change the port if need be, but usually you cannot change the transport layer to e.g. UDP.

      Therefore it might not really be possible to make your "web-server" react on UDP packets.

    • If, however, by "web server" you mean a host accesible on the internet (that eventually might happen to run an http-daemon), you might have more luck: simply run a small server-application on that machine that listens to incoming UDP traffic on a given port, and do "something" with it (e.g. forward it to an http-daemon to display the current location)

    Answers to your 3 questions:

    1. Creating a small application listening on UDP-traffic:

    a trivial server could be:

     `netcat -l -u -p 8888`
    

    This will create a UDP-server listening on port 8888, using netcat. Whatever client connects to your server, everything that the client sends to the server will be output via stdout, and you can talk back to the client via stdin. You shouldn't use netcat in a production environment; but it is a good and simple tool to check whether a connetion can be established and whether the protocol works.

    In production, you will probably want to use a "real" UDP-server, e.g. by writing your own in the language of your choice.

    1. How to make your gprs device talk to your server? This is impossible to answer without knowing more about the device, it's OS and the software installed that produces the data and is supposed to send it to the.

    2. netcat -l -u -p 8888 > myfile.txt