318
Platforms
©2000-2008 Tibbo Technology Inc.
<!DOCTYPE HTML PUBLIC "-//W3C//DTD W3 HTML//EN">
<HTML>
<BODY>
HELLO WORLD!<br>
</BODY>
</HTML>
Launch the browser, type the IP-address of your device, for example:
"http://192.168.1.95" and you will get the output "HELLO WORLD!".
Don't forget to give your device an IP address. For example, if you are
working through a regular wired Ethernet, you should assign an IP
address through the
property.
Double-duty: non-HTTP and HTTP processing on the same socket
Your HTTP sockets don't have to be exclusively HTTP. You can have them behave
differently depending on which listening port the TCP connection is being made to.
Here is an example: supposing the setup of your device needs to be effected in two
ways- via TELNET or via HTTP. Standard TELNET port is 23, standard HTTP port is
80. Setup your socket like this:
sock.num=f
sock.protocol= PL_SOCK_PROTOCOL_TCP
sock.inconmode= PL_SOCK_INCONMODE_ANY_IP_ANY_PORT
sock.localportlist=
"23"
sock.httpportlist=
"80"
....
The socket will now be accepting connections both on port 23 and port 80. When
connection is made to port 23, the socket will work as a regular data socket, as
was described in previous sections. When connection is made to port 80, the
socket will automatically switch into the HTTP mode!
There is a property-
- that tells you which mode the socket is in-
regular data mode or HTTP. You can even "forcefully" switch any TCP connection
into the HTTP mode by setting sock.httpmode= 1- YES. You cannot, however,
switch this connection back to the data mode, it will remain in the HTTP mode until
termination.
Socket Behavior in the HTTP Mode
When in the HTTP mode, the socket is behaving differently compared to the normal
data mode.
Incoming connection rejection
Accepting Incoming Connections
, if your device "decides" to
reject an incoming TCP connection, it will send out a reset TCP packet. This way,
the other host is instantly notified of the rejection. Rules are different for HTTP
sockets:
If there is an incoming TCP connection to the web server of the device (incoming
HTTP connection request), and if your application has one or more sockets that
are configured to accept this connection, and if all such sockets are already
occupied, then the system will not reply to the requesting host at all.
270
334
279