|
Posted by vishwa89 |
|
|
I have developed an application in django which has to send or receive
requests from/to a server.These requests have to be sent or received through sockets.how do i achieve this? |
|
|
Posted by Annatar |
|
|
Lemme get this straight: you need the backend (your server) to communicate to another server? Cause you cannot use socket communication for communicating with the browser.
Here's a nice tutorial on python socket programming http://www.devshed.com/c/a/Python/Sockets-in-Python-Into-the-World-of-Python-Network-Programming/ But IMHO it's strongly unadvisable to use socket programming in a web application, even in the backend. It's VERY error-prone, and lots of network problems can occur and invalidate your workflow. If your socket module crashes you will have many blocked ports and hanging connections (which you will have to reset manually most of the times) and many requests to your website will remain in an inconsistent state if the socket modules try to make a connection and from some reason they get stuck. It would be best to rely on good old HTTP (and use JSON or XML for transferring data with your server) or if you're daring enough you can use the SOAP/REST approach in your web services.
|


