f



Single-threaded server - Overlapped vs. select()-based approach

Hi!
I'm trying to write a simple asynchronous single-threaded winsock
server application. Because my experience with winsock has never really
gone beyond "hello world" programs, I'm have to study MSDN now to be
able to write my program. And I must say that MSDN documentation is
comprehensible only if you are already familiar with the subject, at
least the chapters concerning Winsock.
The question is what are the differences between server using
overlapped I/O and server using select. I found one example of the
latter here:
http://tangentsoft.net/wskfaq/examples/basics/select-server.html but I
can't find any good example showing the former approach. Can anybody
point me to one?
The select()-based architecture is more or less portable. What are the
other differences?
Thanks in advance.
Adam.

0
Adam
10/20/2006 6:05:45 PM
comp.win.tools.winsock 400 articles. 0 followers. Post Follow

2 Replies
281 Views

Similar Articles

[PageSpeed] 6

"Adam Ciazynski" <adam.ciazynski@gmail.com> wrote in message
news:1161367545.501001.82500@i3g2000cwc.googlegroups.com...
> Hi!
> I'm trying to write a simple asynchronous single-threaded winsock
> server application. Because my experience with winsock has never really
> gone beyond "hello world" programs, I'm have to study MSDN now to be
> able to write my program. And I must say that MSDN documentation is
> comprehensible only if you are already familiar with the subject, at
> least the chapters concerning Winsock.
> The question is what are the differences between server using
> overlapped I/O and server using select. I found one example of the
> latter here:
> http://tangentsoft.net/wskfaq/examples/basics/select-server.html but I
> can't find any good example showing the former approach. Can anybody
> point me to one?
> The select()-based architecture is more or less portable. What are the
> other differences?
> Thanks in advance.
> Adam.
>

You are correct that a select-based architecture will be mostly portable.
With overlapped IO, you will be bound to a specific operating system
(Windows, which might not be all that bad, particularly since you're posting
in a winsock group, depending on your perspective).

However, overlapped programming is one of the more complicated
architectures.  If you are truly trying to write a server that's "simple",
and if your experience level at socket programming is not extensive, then it
might be better to stick with the select-based architecture.

I have not been able to find any examples of overlapped I/O servers.  The
next level up in complexity is IO completion ports (IOCP), and a few samples
of those are available.  A decent IOCP sample is found in the platform SDK.
For my installation of the SDK, the path to the samples is "C:\Program
Files\Microsoft SDK\Samples\netds\WinSock\iocp". The sample includes three
programs: an I/O Completion Port (IOCP) Winsock server using WSAAccept
(iocpserver), an IOCP Winsock server using AcceptEx (iocpserverex) and a
simple multithreaded Winsock client (iocpclient) used to test either server.

For other help, an approachable introduction to completion ports can be
found at "A simple IOCP Server/Client Class" at
http://www.codeproject.com/internet/IOCP_Server_client.asp .

Another good article is found in the October 2000 issue of MSDN magazine:
"Windows Sockets 2.0: Write Scalable Winsock Apps Using Completion Ports" by
Anthony Jones (well-known winsock expert at Microsoft) at
http://msdn.microsoft.com/msdnmag/issues/1000/Winsock/ .

Mike


0
Michael
10/21/2006 3:34:07 PM
> For other help, an approachable introduction to completion ports can be
> found at "A simple IOCP Server/Client Class" at
> http://www.codeproject.com/internet/IOCP_Server_client.asp .
>
> Another good article is found in the October 2000 issue of MSDN magazine:
> "Windows Sockets 2.0: Write Scalable Winsock Apps Using Completion Ports" by
> Anthony Jones (well-known winsock expert at Microsoft) at
> http://msdn.microsoft.com/msdnmag/issues/1000/Winsock/ .

Thanks a lot for pointing me to these excellent articles.
Adam

0
Adam
10/23/2006 10:18:58 AM
Reply:

Similar Artilces:

single threaded vs. multi threaded
1. Which programs lend themselves to be single threaded? 2. Which programs lend themselves to be multi threaded? 3. How to convert a multi threaded program to single threaded program? omar_hashmi786@yahoo.com wrote: > 1. Which programs lend themselves to be single threaded? > 2. Which programs lend themselves to be multi threaded? > 3. How to convert a multi threaded program to single threaded program? Sorry there are no general purpose answers to your questions. Get a book about mulitthreading and read the introduction. Normally this should help you to understand something about...

[9fans] Blocking reads on single-threaded Srv-based 9p server?
I'm implementing a 9p server using plan9port. I'd like one of my files to have "blocking read" or "blocking write" behavior: any such call should block until a write occurs on some other (non-blocking) file in the same server. Is there some reason that I shouldn't implement that in a single-threaded server? The 9p(3) plan9ports manpage suggests that only multi-threaded servers should "block" requests by not respond()ing to them before returning from the associated service routine, and that only multi-threaded servers would need to implement flush()....

How to select Dell based mighty server for Oracle 9i EE for Win XP?
In our shop one of the departments have a problem. Their current environment stinks. Oracle 8i is running on obsolete machine with very slow pace. They will get 9i soon. They asked me to select Dell based server for Oracle 9i EE with 4 disks and controllers with Win XP OS (and may be RAID 5). It is going to be a server machine to keep Oracle 9i and in addition about 40 other non-Oracle applications. I would like to get an advice where to start from. Not all information about these applications is available. So I prefer to write a quote for as much as possible. Sound silly, but it is true. The ...

single threaded vs multi threaded programming
1. Which programs lend themselves to be single threaded? 2. Whcih programs lend themselves to be multi threaded? 3. How to convert a multi threaded program to single threaded program? omar_hashmi786@yahoo.com wrote: > 1. Which programs lend themselves to be single threaded? > 2. Whcih programs lend themselves to be multi threaded? A program doesn't lend itself to being single- or multi-threaded. It either is or isn't. However, there might be tasks for which a single-threaded solution would be better than a multi-threaded solution, or vice versa. > 3. How to convert a mult...

single threaded vs. multi threaded programming
1. What types of application are to be single threaded? 2. What types of application are to be multi threaded? 3. How to convert a multi-threaded program to single-threaded? omar_hashmi786@yahoo.com wrote: > 1. What types of application are to be single threaded? > 2. What types of application are to be multi threaded? > 3. How to convert a multi-threaded program to single-threaded? This is like asking "how do I build a bridge". It's so expansive and vague that it can only be answered with a short joke or a hundred page treatise. If you want general ...

pgsql-server/src port/thread.c tools/thread/th ...
CVSROOT: /cvsroot Module name: pgsql-server Changes by: momjian@svr1.postgresql.org 03/10/24 17:48:10 Modified files: src/port : thread.c src/tools/thread: thread_test.c Log message: Don't reference pthread.h unless we have threads enabled, per Peter. ---------------------------(end of broadcast)--------------------------- TIP 4: Don't 'kill -9' the postmaster ...

Thread based software architecture vs Process based software architecture
Hi, Have few queries on the best possible software architecture. Processes are heavy weight and they appear to occupy more memory, more time= to create/start, increased latency during context switches and separate me= mory space that necessitates heavy IPC mechanisms. Threads are light weight= and share memory space. However, I realized that threads also enter into c= ontention for resources/memory due to the shared resources among them that = inturn becomes a kind of bottle neck for multi-threaded architecture but no= t for multiple process based architecture. Also the workaround ...

Moving WINS clients to another WINS Server from the SERVER
I am trying to get an older Windows NT Server 4.0 WINS Server off-line and move the Ownership WINS records from one database to a new WINS Server on my Windows 2000 Server. I have 200 clients and do not want to go to each desktop. How can I do this from the Server without having to visit each client so that the Clients will resolve to the Windows 2000 WINS Server and not the Windows NT WINS Server. ...

Homebuilt server (NAS/SAN) vs the prefab ones? Peformance differences? SAN vs NAS vs Homebuilt Server
I'm working on building a new server to basically be the backup server for all of our 800GB or so of data. IE: Symantec BackupExec will run on this server.. communicating with remote agents on 4 other servers. Those 4 servers total 800gb of data in a full backup via gigabit ethernet. I'm still not sure I see the difference between a NAS, SAN, or a server with lots of harddrive capacity and dual gigabit ports? For instance.. here is what we are considering doing: Building the server piece by piece for a total of $3200, inclusive of drives and controller cards etc, usi...

Single thread vs synchronization
Hello I want to make an existing library thread-safe as it is now accessed through several threads. The work in the library is done by a single internal thread. External events to be processed are posted to a blocking priority queue and then taken up by that internal thread in the lib. This part is thread safe. I also have getters to read the present state of the lib and setters to set parameters which define how the events are treated. Both of these are accessed by several threads and not yet thread safe. In order to make these safe, I see two possibilities (please comment if others exist). ...

threaded server using select()
Hi there Sorry to bother, but I'm confuse on how to use select() with pthreads. I'm just a beginner in socket programming and needed to program a server that can allow 1600 connections concurrently. From what I understood from several tutorials, a possible way is to use threads. I found a code in beej tutorials using select and another using thread from another source. There is a part in beej: int main(...) .... for(;;) { read_fds = master; // copy it if (select(fdmax+1, &read_fds, NULL, NULL, NULL) == -1) { perror("select"); ex...

Win Win Win Win......
Win Win Win Win...... Win cash Rs.10,000. SMS BLUFF to 57333 (Only For Indian) Free Registration! - Register here Free:- http://offr.biz/HLDDT337130BVGMJPF (....Free Offer is Valid Only For First 250 members who Registered...) ------------------------------------------------------------------------------- ...

ActivePerl Migration Win 2003 Server to Win 2008 Server
Hello, I hope this post is not OT in c.l.p.m. I have got a couple of medium-sized (1000+ lines of code) of Perl programs (64 bits) running on Windows Server 2003, the perl version is: C:\>perl -v This is perl, v5.10.1 built for MSWin32-x64-multi-thread (with 2 registered patches, see perl -V for more detail) Binary build 1007 [291969] provided by ActiveState http://www.ActiveState.com Built Jan 27 2010 14:12:21 I am using ADODB to connect to MSAccess databases, I read ActiveDirectory entries and I use StorageCentral to setup Storage quotas for 1000+ directories. Now I...

matlab performance: win vs linux vs mac who win?
Hi, probably I will buy a new laptop soon and I'm wondering to buy a mac. However in which OS is matlab faster? Thanks Pietro On 27/02/11 1:41 PM, pietro wrote: > probably I will buy a new laptop soon and I'm wondering to buy a mac. > However in which OS is matlab faster? It is a bit early to say, as the new MacBook Pro have just been released. With the previous MacBook Pro, there were some reports that performance was measurably worse under OS X than if you run the Windows version of Matlab under Parallels on the very same machine. The MacBook Pro l...

pgsql-server/src/tools/thread
CVSROOT: /cvsroot Module name: pgsql-server Changes by: momjian@svr1.postgresql.org 03/09/26 22:53:24 pgsql-server/src/tools/thread Update of /cvsroot/pgsql-server/src/tools/thread In directory svr1.postgresql.org:/var/tmp/cvs-serv16755/thread Log Message: Directory /cvsroot/pgsql-server/src/tools/thread added to the repository ---------------------------(end of broadcast)--------------------------- TIP 4: Don't 'kill -9' the postmaster ...

Web resources about - Single-threaded server - Overlapped vs. select()-based approach - comp.win.tools.winsock

Firefox Javascript Engine Becomes Single Threaded
... blog: "With web workers in separate runtimes, there were no significant multi-threaded runtime uses remaining. Furthermore, to achieve single-threaded ...

Threaded through a pore: Single-molecule detection of hydroxymethylcytosine in DNA
(Phys.org) —Changes in the bases that make up DNA act as markers, telling a cell which genes it should read and which it shouldn't. In the journal ...

Resources last updated: 1/28/2016 6:41:18 AM