Friday, March 27, 2015

Re: Django TCP socket communication

There is a sense in which what you are describing, for the Django side, is what a webserver, including one involving Django, ordinarily does.

The only requirement the web server makes (and some can get around it with work) is that the data sent over the socket, at least from the client (microcontroller) to the server be formatted as HTTP.  That's not a big deal to do.  It could consist of a canned (or nearly so, if the length of your data varies) header in front of what you actually want to send.

The format of the data in the reply is potentially even more flexible.

Particularly if the connection is closed after each round trip, that's very vanilla web serving.

And if you can see your way to doing it as an HTTP request/response pair, that will significantly reduce your need to code at a low level on the server side.

As to what libraries you use on the microcontroller side, that depends on what microcontroller, and what software it is running.  (With Linux on a Raspberry Pi, this is a trivial Python program.  It is probably tougher on a Teensy.)

On Fri, Mar 27, 2015 at 3:03 PM, Bobby <anudeepsm@gmail.com> wrote:
I am new to TCP socket programming. I have a django based server communicating with a microcontroller. Now, I want to implement TCP based socket on the server side in order to communicate with the TCP socket on the microcontroller. Can anyone give me an idea on how to do this ? What libraries should I use on my django server The microprocessor basically opens the socket every 5 seconds and sends a notification to the server. I on the server side should be able to read this and pump data back to the microprocessor using this socket which was opened by the microprocessor.

--
You received this message because you are subscribed to the Google Groups "Django users" group.
To unsubscribe from this group and stop receiving emails from it, send an email to django-users+unsubscribe@googlegroups.com.
To post to this group, send email to django-users@googlegroups.com.
Visit this group at http://groups.google.com/group/django-users.
To view this discussion on the web visit https://groups.google.com/d/msgid/django-users/5ea5bf85-0163-40cf-a4da-ec9edb27f3ac%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.

--
You received this message because you are subscribed to the Google Groups "Django users" group.
To unsubscribe from this group and stop receiving emails from it, send an email to django-users+unsubscribe@googlegroups.com.
To post to this group, send email to django-users@googlegroups.com.
Visit this group at http://groups.google.com/group/django-users.
To view this discussion on the web visit https://groups.google.com/d/msgid/django-users/CAB%2BAj0skk4OL_Ofai%2Bwwd%3DhmGWWu6ZcfCmcxjOODjJL8FdS3%3DA%40mail.gmail.com.
For more options, visit https://groups.google.com/d/optout.

No comments:

Post a Comment