The code examples in these tutorials are in Python and C, but translate well to other languages. Part 1 covers the basics, such as an echo server and client, which connect over TCP/IP, fundamental network, layer, and protocol concepts. Part 2 is an intermediate level tutorial that demonstrates how to write UDP sockets applications.
Is it possible to use http over a local socket?
You mean as in a loopback connection (127.0.0.1)? Absolutely.
If you mean over a unix socket or so, it is possible also, provided that both server and client support it. It is easy to have the server supporting it, as most servers allow to be called from a tcp wrapper, thus not needing to know where they’re getting the data from and sending the data to, as long as it is a file descriptor.
As for the (browsers and wget and etc) the easiest way is to setup a wrapper to listen to a loopback tcp socket and forward to the unix socket.
HTTP is a protocol. You could put anything over a socket you wanted to.
Clicking the article links:
——————–
This site requires all users to sign in with IBM IDs and passwords, which can be used site-wide. You will need an IBM ID to continue. (If you have a PartnerWorld or developerWorks userid, that is considered your IBM ID). If you have not registered yet with IBM, please click the ‘Register’ link below, otherwise sign in now.
——————–
The 2 links needs IBM registration Id.
use bugmenot, and support the open registration revolution
.. and the reason I am asking is because I wonder if not http could be used as protocol for “local webapps”, using web technologies (http, xml/html) for non-distributed applications. loopback connections will accept requests from other hosts unless special firewall measures are applied. I thought perhaps http assumed TCP/IP underneath.
Seems I found the answer here (http://www.faqs.org/faqs/internet/tcp-ip/tcp-ip-faq/part2/):
4. HTTP
Hyper Text Transfer Protocol (HTTP) is the protocol used to move
Web pages across an internet. Version 1.0 of HTTP is defined by
RFC 1945. Version 1.1 makes more efficient use of TCP and is
defined by RFC 2068.
HTTP depends on TCP to guarantee the correct and orderly delivery
of data across the network.
No, loopback connections only accept local connections. If you have your server listening to 127.0.0.1 instead of 0.0.0.0 or the network interface IP address, no connection can be made from external hosts.
HTTP is not directly dependant on TCP but rather on a stream type socket. They refer TCP in that FAQ by opposition to UDP (datagram) sockets. TCP is a stream socket and unix sockets do that work too.
I was in the middle of reading it and now the site doesn’t work
, looked good so far though.
Thanks for the answers, Jay. The security issue with using http for local web applications seems solved then… any web server should be able to work for this
If you do not want to register or are not a fan of David Mertz then check out these other sites or simply Google for “bsd sockets”
http://www-users.cs.umn.edu/~bentlema/unix/
http://www.macdevcenter.com/pub/a/mac/2002/12/26/cocoa.html?page=2
Is it any better than http://www.ecst.csuchico.edu/~beej/guide/net ?
Read this http://www.ics.uci.edu/~fielding/pubs/dissertation/top.htm for some background on HTTP. You will find that HTTP is a solution on how to have a gigantic set of uncordinated actors be able to communicate over an uncontrolled network.
In your case this is hardly the case, just skip HTTP and save yourself some overhead.
you might want to limit your self to Chapter 4 and 5 to save some time