aboutsummaryrefslogtreecommitdiff
path: root/pipermail/nel/2001-February/000291.html
blob: 0a6ba1f575ea61cdcfd5da47074547ff13d76172 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 3.2//EN">
<HTML>
 <HEAD>
   <TITLE> [Nel] NeL Network Engine</TITLE>
   <LINK REL="Index" HREF="index.html" >
   <LINK REL="made" HREF="mailto:cblt%40cblt.org">
   <LINK REL="Previous"  HREF="000289.html">
   <LINK REL="Next" HREF="000294.html">
 </HEAD>
 <BODY BGCOLOR="#ffffff">
   <H1>[Nel] NeL Network Engine</H1>
    <B>Nicolas Hognon</B> 
    <A HREF="mailto:cblt%40cblt.org"
       TITLE="[Nel] NeL Network Engine">cblt@cblt.org</A><BR>
    <I>Wed, 28 Feb 2001 10:57:11 +0100</I>
    <P><UL>
        <LI> Previous message: <A HREF="000289.html">[Nel] NeL Network Engine</A></li>
        <LI> Next message: <A HREF="000294.html">[Nel] NeL Network Engine</A></li>
         <LI> <B>Messages sorted by:</B> 
              <a href="date.html#291">[ date ]</a>
              <a href="thread.html#291">[ thread ]</a>
              <a href="subject.html#291">[ subject ]</a>
              <a href="author.html#291">[ author ]</a>
         </LI>
       </UL>
    <HR>  
<!--beginarticle-->
<PRE>
&gt;<i> In this case, we have to forget the solution where each
</I>&gt;<i> socket is on a thread and use a blocked receive(). The problem is that
</I>&gt;<i> select() is quite slow and if we have only 100 thread,
</I>&gt;<i> each thread needs to manage, with a select(), around 50 players and we ll
</I>&gt;<i> lost lot of time to create the array for the select()
</I>&gt;<i> and check who have wakeup the select().
</I>
I encouter the same problem : one thread must manage more than one 
socket on the server. the problem is how managing those socket
in the thread. the problem is I want to be portable between windows
and linux :((

under windows there is many solution :
  - select (the only one which is portable)
  - windows event and message
  - overlapped I/O

under linux the only solution I know is :
  - select / poll :  i'm not sure but i think the difference between
    select and poll is that with poll you don't have to fill your array
    before each call.

another problem when a thread maange more than one socket is
what your threads will do :

a first approch is something like that :

while(run)
{
   TestSokets();

   for each socket which received something
   do
     read the incoming data
     process the data
     send data
   done
}

but during one step of this loop your socket list must be locked
so if a new socket need to enter this thread the calling thread will be
blocked.

a solution is to have more than one thread type.
thread which test and read socket (perhaps wire in socket to)
thread which to process a network message queue.
(and perhaps thread which send network message)

but it increase the number of thread so the maximum
number of client is lesser.

but i'm not really used to programming with thread yet so perhaps
my problem are not really problems.

i hope this can help and you can understand me :))
and i think i'll take a look at <A HREF="http://oss.sgi.com/projects/state-threads/">http://oss.sgi.com/projects/state-threads/</A>
to ...

good luck


-- 
Nicolas Hognon
<A HREF="mailto:nicolash@virtools.com">nicolash@virtools.com</A>

Virtools - The Behavior Company
Tel. (+33) 1 42 71 46 86 / Fax. (+33) 1 42 71 86 53
<A HREF="http://www.virtools.com/">http://www.virtools.com/</A>


</pre>



<!--endarticle-->
    <HR>
    <P><UL>
        <!--threads-->
	<LI> Previous message: <A HREF="000289.html">[Nel] NeL Network Engine</A></li>
	<LI> Next message: <A HREF="000294.html">[Nel] NeL Network Engine</A></li>
         <LI> <B>Messages sorted by:</B> 
              <a href="date.html#291">[ date ]</a>
              <a href="thread.html#291">[ thread ]</a>
              <a href="subject.html#291">[ subject ]</a>
              <a href="author.html#291">[ author ]</a>
         </LI>
       </UL>
</body></html>