NetTalk Central

Author Topic: Comparision of Server, SimpleServer and WebServer  (Read 4223 times)

Wolfgang Orth

  • Sr. Member
  • ****
  • Posts: 251
    • View Profile
    • oData Wolfgang Orth
Comparision of Server, SimpleServer and WebServer
« on: April 30, 2011, 05:05:36 AM »
Hello all,

as the subject says, I wonder what the differences between NetServer, NetSimpleServer and NetWebServer are.

As far as I understood, a SOAPserver is no animal on its own, but its just a Webserver.

Couldn't it be a SimpleServer also? A SimpleServer does not care much what it receives, as long as it is a XML-structure, it simply parses it (using xFiles) and therefore I would call it a SOAPserver also.

The printed manual has an example on page 87, where a Webserver is used and a NetWebPage is set up to receive the data.

But I guess, a SimpleServer could also receive a XML-structure and do the parsing in the .Process-method.

Is this possible but less recommended, rather than making it a Webserver and a NetWebPage?

If my questioning sounds confused, I can asure you that I am. <g>

Thanks for some hints on the road to Clarification.

Bruce

  • Global Moderator
  • Hero Member
  • *****
  • Posts: 11250
    • View Profile
Re: Comparision of Server, SimpleServer and WebServer
« Reply #1 on: May 01, 2011, 06:50:35 AM »
Good question Wolfgang.

First a NetServer - also known as a "NetAutoServer". This server is a high-level server, typically used on a LAN (and difficult to use on a WAN). It talks to the NetClient and is the foundation for classes like NetRefresh, and NetAutoClose and so on. It's not really suitable for SOAP.

The WebServer class is derived from the NetSimple class. So yes, anything you do with the WebServer can be done with NetSimple - albeit with a bit more work.

The primary reasons for choosing WebServer over NetSimple are;

a) thread-management. The Web-Server is designed to handle multiple incoming requests simultaneously (by starting a WebHandler for each request). Out the box, a NetSimple object would handle one request at a time, queuing the other requests while it is busy. Practically this has benefit when the WebServer is running on a multi-core CPU - the requests can be shared across the cores.

b) HTTP protocol - you don't need HTTP to make a web service, but it is the most common transport for it. If you use port 80 then you really must use HTTP though because many proxy servers will prevent traffic on port 80 that isn't HTTP. If you use a port other than port 80 then you have the usual port-opening issues etc. Also "SOAP over HTTP" is the most common way of doing a "web service" so it makes your service ultimately more compatible with other programmers wanting to use it.

c) Packet boundaries - plain TCP (which is what Netsimple is) does not have fixed packet boundaries. So you need to know when you have received the whole request. In other words the request is wrapped in some kind of "protocol" - in HTTP there is a content-length header for example. The WebServer object makes all of this go away as it's done internally by the class.

Which is not to say you can't implement a request-response protocol of your own using a NetSimple server (and possibly a NetSimple client on the other side.) ALL internet protocols can be implemented using NetSimple (well all the ones that matter to you) and you're free to make up new ones if you wish. (I certainly have <g>).

Cheers
Bruce



Wolfgang Orth

  • Sr. Member
  • ****
  • Posts: 251
    • View Profile
    • oData Wolfgang Orth
Re: Comparision of Server, SimpleServer and WebServer
« Reply #2 on: May 01, 2011, 07:14:18 AM »
c) Packet boundaries - plain TCP ...
The WebServer object makes all of this go away as it's done internally by the class.

This means, I do not have to worry about the 16k limitation of the packets, because once all packets have arrived _completely_ I know that in the .PageReceived method?

No need to TempString = CLIP(TempString) & ReceivedString.....

Thanks for your broad description!