<html xmlns:v="urn:schemas-microsoft-com:vml" xmlns:o="urn:schemas-microsoft-com:office:office" xmlns:w="urn:schemas-microsoft-com:office:word" xmlns:m="http://schemas.microsoft.com/office/2004/12/omml" xmlns="http://www.w3.org/TR/REC-html40"><head><meta http-equiv=Content-Type content="text/html; charset=iso-2022-jp"><meta name=Generator content="Microsoft Word 12 (filtered medium)"><style><!--
/* Font Definitions */
@font-face
{font-family:"$B#M#S(B $B%4%7%C%/(B";
panose-1:2 11 6 9 7 2 5 8 2 4;}
@font-face
{font-family:"Cambria Math";
panose-1:2 4 5 3 5 4 6 3 2 4;}
@font-face
{font-family:"\@$B#M#S(B $B%4%7%C%/(B";
panose-1:2 11 6 9 7 2 5 8 2 4;}
/* Style Definitions */
p.MsoNormal, li.MsoNormal, div.MsoNormal
{margin:0mm;
margin-bottom:.0001pt;
text-align:justify;
text-justify:inter-ideograph;
font-size:10.5pt;
font-family:"Arial","sans-serif";}
a:link, span.MsoHyperlink
{mso-style-priority:99;
color:blue;
text-decoration:underline;}
a:visited, span.MsoHyperlinkFollowed
{mso-style-priority:99;
color:purple;
text-decoration:underline;}
p.MsoPlainText, li.MsoPlainText, div.MsoPlainText
{mso-style-priority:99;
mso-style-link:"$B=q<0$J$7(B \($BJ8;z(B\)";
margin:0mm;
margin-bottom:.0001pt;
font-size:10.0pt;
font-family:"$B#M#S(B $B%4%7%C%/(B";}
span.17
{mso-style-type:personal-compose;
font-family:"Arial","sans-serif";
color:windowtext;}
span.a
{mso-style-name:"$B=q<0$J$7(B \($BJ8;z(B\)";
mso-style-priority:99;
mso-style-link:$B=q<0$J$7(B;
font-family:"$B#M#S(B $B%4%7%C%/(B";}
.MsoChpDefault
{mso-style-type:export-only;}
/* Page Definitions */
@page WordSection1
{size:612.0pt 792.0pt;
margin:99.25pt 30.0mm 30.0mm 30.0mm;}
div.WordSection1
{page:WordSection1;}
--></style><!--[if gte mso 9]><xml>
<o:shapedefaults v:ext="edit" spidmax="1026">
<v:textbox inset="5.85pt,.7pt,5.85pt,.7pt" />
</o:shapedefaults></xml><![endif]--><!--[if gte mso 9]><xml>
<o:shapelayout v:ext="edit">
<o:idmap v:ext="edit" data="1" />
</o:shapelayout></xml><![endif]--></head><body lang=JA link=blue vlink=purple style='text-justify-trim:punctuation'><div class=WordSection1><p class=MsoPlainText>$B$*@$OC$K$J$j$^$9!#(B<span lang=EN-US>TFC </span>$B>.NS$G$9!#(B<span lang=EN-US><o:p></o:p></span></p><p class=MsoNormal><span lang=EN-US style='font-size:10.0pt'><o:p> </o:p></span></p><p class=MsoNormal><span lang=EN-US style='font-size:10.0pt'>Armadillo-300</span><span style='font-size:10.0pt;font-family:"$B#M#S(B $B%4%7%C%/(B"'>$B$K$F!"(B</span><span lang=EN-US style='font-size:10.0pt'><o:p></o:p></span></p><p class=MsoNormal><span lang=EN-US style='font-size:10.0pt'>ETHER</span><span style='font-size:10.0pt;font-family:"$B#M#S(B $B%4%7%C%/(B"'>$B$K$F!"%G!<%?$rAw<u$5$;$J$,$i!"(B</span><span lang=EN-US style='font-size:10.0pt'><o:p></o:p></span></p><p class=MsoNormal><span style='font-size:10.0pt;font-family:"$B#M#S(B $B%4%7%C%/(B"'>$B3HD%%P%9Ey$NF0:n$b9T$&$h$&$J%W%m%0%i%`$r:n$C$F$$$^$9!#(B</span><span lang=EN-US style='font-size:10.0pt'><o:p></o:p></span></p><p class=MsoNormal><span lang=EN-US style='font-size:10.0pt'><o:p> </o:p></span></p><p class=MsoNormal><span lang=EN-US style='font-size:10.0pt'>1</span><span style='font-size:10.0pt;font-family:"$B#M#S(B $B%4%7%C%/(B"'>$BIC$N%?%$%^!<$r:n@.$7$?8e!"(B</span><span lang=EN-US style='font-size:10.0pt'><o:p></o:p></span></p><p class=MsoNormal><span lang=EN-US style='font-size:10.0pt'>ETHER</span><span style='font-size:10.0pt;font-family:"$B#M#S(B $B%4%7%C%/(B"'>$B$G@\B3BT$A$r9T$$!"(B</span><span lang=EN-US style='font-size:10.0pt'><o:p></o:p></span></p><p class=MsoNormal><span style='font-size:10.0pt;font-family:"$B#M#S(B $B%4%7%C%/(B"'>$B$=$N4V!"B>$N:n6H$r$7$J$,$i!"(B</span><span lang=EN-US style='font-size:10.0pt'><o:p></o:p></span></p><p class=MsoNormal><span lang=EN-US style='font-size:10.0pt'>ETHER</span><span style='font-size:10.0pt;font-family:"$B#M#S(B $B%4%7%C%/(B"'>$B$N=hM}$d!"(B</span><span lang=EN-US style='font-size:10.0pt'>1</span><span style='font-size:10.0pt;font-family:"$B#M#S(B $B%4%7%C%/(B"'>$BIC$N%?%$%^!<$N3d$j9~$_$r$5$;$?$$$N$G$9$,!"(B</span><span lang=EN-US style='font-size:10.0pt'><o:p></o:p></span></p><p class=MsoNormal><span lang=EN-US style='font-size:10.0pt'>select</span><span style='font-size:10.0pt;font-family:"$B#M#S(B $B%4%7%C%/(B"'>$B$NLa$jCM$,(B</span><span lang=EN-US style='font-size:10.0pt'>-1</span><span style='font-size:10.0pt;font-family:"$B#M#S(B $B%4%7%C%/(B"'>$B$K$J(B$B$C$F$7$^$$!"$=$NA08e$G?t(B</span><span lang=EN-US style='font-size:10.0pt'>ms</span><span style='font-size:10.0pt;font-family:"$B#M#S(B $B%4%7%C%/(B"'>$B$NF0:n$,(B</span><span lang=EN-US style='font-size:10.0pt'><o:p></o:p></span></p><p class=MsoNormal><span style='font-size:10.0pt;font-family:"$B#M#S(B $B%4%7%C%/(B"'>$B8G$^$C$F$7$^$&$N$+!"B>$N:n6H$,?t(B</span><span lang=EN-US style='font-size:10.0pt'>ms</span><span style='font-size:10.0pt;font-family:"$B#M#S(B $B%4%7%C%/(B"'>$B;_$^$C$F$7$^$$$^$9!#(B</span><span lang=EN-US style='font-size:10.0pt'><o:p></o:p></span></p><p class=MsoNormal><span lang=EN-US style='font-size:10.0pt'><o:p> </o:p></span></p><p class=MsoNormal><span style='font-size:10.0pt;font-family:"$B#M#S(B $B%4%7%C%/(B"'>$B%?%$%^!<$r;HMQ$7$J$1$l$P!"(B</span><span lang=EN-US style='font-size:10.0pt'>ETHER</span><span style='font-size:10.0pt;font-family:"$B#M#S(B $B%4%7%C%/(B"'>$B$N=hM}$HB>$N:n6H$,(B</span><span lang=EN-US style='font-size:10.0pt'><o:p></o:p></span></p><p class=MsoNormal><span style='font-size:10.0pt;font-family:"$B#M#S(B $B%4%7%C%/(B"'>$B8r8_$K8G$^$k$3$H$J$/F0$/$N$G$9$,!"(B</span><span lang=EN-US style='font-size:10.0pt'><o:p></o:p></span></p><p class=MsoNormal><span lang=EN-US style='font-size:10.0pt'>select</span><span style='font-size:10.0pt;font-family:"$B#M#S(B $B%4%7%C%/(B"'>$B$H!"(B</span><span lang=EN-US style='font-size:10.0pt'>timer_create</span><span style='font-size:10.0pt;font-family:"$B#M#S(B $B%4%7%C%/(B"'>$B$rF1;~$K;H$&$K$O$I$&$7$F$"$2$l$P$$$$$N$G$7$g$&$+!)(B</span><span lang=EN-US style='font-size:10.0pt'><o:p></o:p></span></p><p class=MsoNormal><span lang=EN-US style='font-size:10.0pt'><o:p> </o:p></span></p><p class=MsoNormal><span lang=EN-US style='font-size:10.0pt'><o:p> </o:p></span></p><p class=MsoNormal><span lang=EN-US style='font-size:10.0pt'>P.S. </span><span style='font-family:"$B#M#S(B $B%4%7%C%/(B"'>$B9B^<$5$^!#(B</span><span lang=EN-US><o:p></o:p></span></p><p class=MsoNormal><span style='font-size:10.0pt;font-family:"$B#M#S(B $B%4%7%C%/(B"'>$B!V(B</span><span lang=EN-US style='font-size:10.0pt'>Armadillo-300</span><span style='font-size:10.0pt;font-family:"$B#M#S(B $B%4%7%C%/(B"'>$B$K$*$1$k(B</span><span lang=EN-US style='font-size:10.0pt'>tftpdl</span><span style='font-size:10.0pt;font-family:"$B#M#S(B $B%4%7%C%/(B"'>$B$G$N%U%i%C%7%e=q$-9~$_!W$N7o$G$9$,!"(B</span><span lang=EN-US style='font-size:10.0pt'><o:p></o:p></span></p><p class=MsoNormal><span style='font-size:10.0pt;font-family:"$B#M#S(B $B%4%7%C%/(B"'>$B65$($F$$$?$@$$$?$3$H$r$d$C$F$_$^$7$?$,!"JQ2=$J$7$G<c43D|$a5$L#$G$9!#(B</span><span lang=EN-US style='font-size:10.0pt'><o:p></o:p></span></p><p class=MsoNormal><span lang=EN-US style='font-size:10.0pt'><o:p> </o:p></span></p><p class=MsoNormal><span lang=EN-US style='font-size:10.0pt'><o:p> </o:p></span></p><p class=MsoNormal><span style='font-size:10.0pt;font-family:"$B#M#S(B $B%4%7%C%/(B"'>$B"-!!0J2<%=!<%9%3!<%I(B</span><span lang=EN-US style='font-size:10.0pt'><o:p></o:p></span></p><p class=MsoNormal><span lang=EN-US style='font-size:10.0pt'><o:p> </o:p></span></p><p class=MsoNormal><span lang=EN-US style='font-size:10.0pt'><o:p> </o:p></span></p><p class=MsoNormal><span lang=EN-US style='font-size:10.0pt'>#include <stdio.h><o:p></o:p></span></p><p class=MsoNormal><span lang=EN-US style='font-size:10.0pt'>#include <string.h><o:p></o:p></span></p><p class=MsoNormal><span lang=EN-US style='font-size:10.0pt'>#include <unistd.h><o:p></o:p></span></p><p class=MsoNormal><span lang=EN-US style='font-size:10.0pt'>#include <fcntl.h><o:p></o:p></span></p><p class=MsoNormal><span lang=EN-US style='font-size:10.0pt'>#include <sys/types.h><o:p></o:p></span></p><p class=MsoNormal><span lang=EN-US style='font-size:10.0pt'>#include <sys/socket.h><o:p></o:p></span></p><p class=MsoNormal><span lang=EN-US style='font-size:10.0pt'>#include <sys/mman.h><o:p></o:p></span></p><p class=MsoNormal><span lang=EN-US style='font-size:10.0pt'>#include <sys/time.h><o:p></o:p></span></p><p class=MsoNormal><span lang=EN-US style='font-size:10.0pt'>#include <netinet/in.h><o:p></o:p></span></p><p class=MsoNormal><span lang=EN-US style='font-size:10.0pt'>#include <arpa/inet.h><o:p></o:p></span></p><p class=MsoNormal><span lang=EN-US style='font-size:10.0pt'>#include <netdb.h><o:p></o:p></span></p><p class=MsoNormal><span lang=EN-US style='font-size:10.0pt'>#include <errno.h><o:p></o:p></span></p><p class=MsoNormal><span lang=EN-US style='font-size:10.0pt'>#include <sys/mount.h><o:p></o:p></span></p><p class=MsoNormal><span lang=EN-US style='font-size:10.0pt'>#include <sys/time.h><o:p></o:p></span></p><p class=MsoNormal><span lang=EN-US style='font-size:10.0pt'>#include <time.h><o:p></o:p></span></p><p class=MsoNormal><span lang=EN-US style='font-size:10.0pt'>#include <signal.h><o:p></o:p></span></p><p class=MsoNormal><span lang=EN-US style='font-size:10.0pt'><o:p> </o:p></span></p><p class=MsoNormal><span lang=EN-US style='font-size:10.0pt'>#define SOCKET_MAX 10<o:p></o:p></span></p><p class=MsoNormal><span lang=EN-US style='font-size:10.0pt'>#define PORTNO 8200<o:p></o:p></span></p><p class=MsoNormal><span lang=EN-US style='font-size:10.0pt'><o:p> </o:p></span></p><p class=MsoNormal><span lang=EN-US style='font-size:10.0pt'>// ****************************************************************************<o:p></o:p></span></p><p class=MsoNormal><span lang=EN-US style='font-size:10.0pt'>// Timer </span><span style='font-size:10.0pt;font-family:"$B#M#S(B $B%4%7%C%/(B"'>$B3d$j9~$_(B</span><span lang=EN-US style='font-size:10.0pt'><o:p></o:p></span></p><p class=MsoNormal><span lang=EN-US style='font-size:10.0pt'>// ****************************************************************************<o:p></o:p></span></p><p class=MsoNormal><span lang=EN-US style='font-size:10.0pt'>static void handler(int signo)<o:p></o:p></span></p><p class=MsoNormal><span lang=EN-US style='font-size:10.0pt'>{<o:p></o:p></span></p><p class=MsoNormal><span lang=EN-US style='font-size:10.0pt'> printf("Timer In!\n");<o:p></o:p></span></p><p class=MsoNormal><span lang=EN-US style='font-size:10.0pt'>}<o:p></o:p></span></p><p class=MsoNormal><span lang=EN-US style='font-size:10.0pt'><o:p> </o:p></span></p><p class=MsoNormal><span lang=EN-US style='font-size:10.0pt'>// ****************************************************************************<o:p></o:p></span></p><p class=MsoNormal><span lang=EN-US style='font-size:10.0pt'>// main<o:p></o:p></span></p><p class=MsoNormal><span lang=EN-US style='font-size:10.0pt'>// ****************************************************************************<o:p></o:p></span></p><p class=MsoNormal><span lang=EN-US style='font-size:10.0pt'>int main(int argc, char *argv[])<o:p></o:p></span></p><p class=MsoNormal><span lang=EN-US style='font-size:10.0pt'>{<o:p></o:p></span></p><p class=MsoNormal><span lang=EN-US style='font-size:10.0pt'><o:p> </o:p></span></p><p class=MsoNormal><span lang=EN-US style='font-size:10.0pt'> struct sockaddr_in saddr;<o:p></o:p></span></p><p class=MsoNormal><span lang=EN-US style='font-size:10.0pt'> struct sockaddr_in caddr;<o:p></o:p></span></p><p class=MsoNormal><span lang=EN-US style='font-size:10.0pt'> fd_set readfds;<o:p></o:p></span></p><p class=MsoNormal><span lang=EN-US style='font-size:10.0pt'> int skt[SOCKET_MAX];<o:p></o:p></span></p><p class=MsoNormal><span lang=EN-US style='font-size:10.0pt'> int res;<o:p></o:p></span></p><p class=MsoNormal><span lang=EN-US style='font-size:10.0pt'> int sf=-1;<o:p></o:p></span></p><p class=MsoNormal><span lang=EN-US style='font-size:10.0pt'> int i = 0;<o:p></o:p></span></p><p class=MsoNormal><span lang=EN-US style='font-size:10.0pt'> unsigned char buf[0x1000];<o:p></o:p></span></p><p class=MsoNormal><span lang=EN-US style='font-size:10.0pt'> int len = 0;<o:p></o:p></span></p><p class=MsoNormal><span lang=EN-US style='font-size:10.0pt'> int ack = 0;<o:p></o:p></span></p><p class=MsoNormal><span lang=EN-US style='font-size:10.0pt'><o:p> </o:p></span></p><p class=MsoNormal><span lang=EN-US style='font-size:10.0pt'> // </span><span style='font-size:10.0pt;font-family:"$B#M#S(B $B%4%7%C%/(B"'>$B%?%$%`%"%&%HCM@_Dj(B</span><span lang=EN-US style='font-size:10.0pt'> <o:p></o:p></span></p><p class=MsoNormal><span lang=EN-US style='font-size:10.0pt'> struct timeval* pTimeval = NULL;<o:p></o:p></span></p><p class=MsoNormal><span lang=EN-US style='font-size:10.0pt'> struct timeval timeout;<o:p></o:p></span></p><p class=MsoNormal><span lang=EN-US style='font-size:10.0pt'><o:p> </o:p></span></p><p class=MsoNormal><span lang=EN-US style='font-size:10.0pt'> struct sigaction sigact;<o:p></o:p></span></p><p class=MsoNormal><span lang=EN-US style='font-size:10.0pt'> timer_t timerId;<o:p></o:p></span></p><p class=MsoNormal><span lang=EN-US style='font-size:10.0pt'> struct itimerspec itval;<o:p></o:p></span></p><p class=MsoNormal><span lang=EN-US style='font-size:10.0pt'><o:p> </o:p></span></p><p class=MsoNormal><span lang=EN-US style='font-size:10.0pt'>////////////////////////////////////////////////////////////////////////////////<o:p></o:p></span></p><p class=MsoNormal><span lang=EN-US style='font-size:10.0pt'>//Timer </span><span style='font-size:10.0pt;font-family:"$B#M#S(B $B%4%7%C%/(B"'>$B%$%K%7%c%k(B</span><span lang=EN-US style='font-size:10.0pt'><o:p></o:p></span></p><p class=MsoNormal><span lang=EN-US style='font-size:10.0pt'><o:p> </o:p></span></p><p class=MsoNormal><span lang=EN-US style='font-size:10.0pt'> sigact.sa_handler = handler;<o:p></o:p></span></p><p class=MsoNormal><span lang=EN-US style='font-size:10.0pt'> sigact.sa_flags = 0;<o:p></o:p></span></p><p class=MsoNormal><span lang=EN-US style='font-size:10.0pt'> sigemptyset(&sigact.sa_mask);<o:p></o:p></span></p><p class=MsoNormal><span lang=EN-US style='font-size:10.0pt'><o:p> </o:p></span></p><p class=MsoNormal><span lang=EN-US style='font-size:10.0pt'>// </span><span style='font-size:10.0pt;font-family:"$B#M#S(B $B%4%7%C%/(B"'>$B%O%s%I%i@_Dj(B</span><span lang=EN-US style='font-size:10.0pt'><o:p></o:p></span></p><p class=MsoNormal><span lang=EN-US style='font-size:10.0pt'> if(sigaction(SIGALRM,&sigact,NULL) == -1)<o:p></o:p></span></p><p class=MsoNormal><span lang=EN-US style='font-size:10.0pt'> {<o:p></o:p></span></p><p class=MsoNormal><span lang=EN-US style='font-size:10.0pt'> perror("sigaction");<o:p></o:p></span></p><p class=MsoNormal><span lang=EN-US style='font-size:10.0pt'> }<o:p></o:p></span></p><p class=MsoNormal><span lang=EN-US style='font-size:10.0pt'><o:p> </o:p></span></p><p class=MsoNormal><span lang=EN-US style='font-size:10.0pt'> itval.it_interval.tv_sec = 1;<o:p></o:p></span></p><p class=MsoNormal><span lang=EN-US style='font-size:10.0pt'> itval.it_interval.tv_nsec = 0;<o:p></o:p></span></p><p class=MsoNormal><span lang=EN-US style='font-size:10.0pt'> itval.it_value.tv_sec = 1;<o:p></o:p></span></p><p class=MsoNormal><span lang=EN-US style='font-size:10.0pt'> itval.it_value.tv_nsec = 0;<o:p></o:p></span></p><p class=MsoNormal><span lang=EN-US style='font-size:10.0pt'><o:p> </o:p></span></p><p class=MsoNormal><span lang=EN-US style='font-size:10.0pt'> // ***** </span><span style='font-size:10.0pt;font-family:"$B#M#S(B $B%4%7%C%/(B"'>$B%?%$%^!<:n@.(B</span><span lang=EN-US style='font-size:10.0pt'> *****<o:p></o:p></span></p><p class=MsoNormal><span lang=EN-US style='font-size:10.0pt'> if(timer_create(CLOCK_REALTIME,NULL,&timerId) == -1)<o:p></o:p></span></p><p class=MsoNormal><span lang=EN-US style='font-size:10.0pt'> {<o:p></o:p></span></p><p class=MsoNormal><span lang=EN-US style='font-size:10.0pt'> perror("timer_create");<o:p></o:p></span></p><p class=MsoNormal><span lang=EN-US style='font-size:10.0pt'> }<o:p></o:p></span></p><p class=MsoNormal><span lang=EN-US style='font-size:10.0pt'> // ***** </span><span style='font-size:10.0pt;font-family:"$B#M#S(B $B%4%7%C%/(B"'>$B%?%$%^!<@_Dj(B</span><span lang=EN-US style='font-size:10.0pt'> *****<o:p></o:p></span></p><p class=MsoNormal><span lang=EN-US style='font-size:10.0pt'> if(timer_settime(timerId,0,&itval,NULL) == -1)<o:p></o:p></span></p><p class=MsoNormal><span lang=EN-US style='font-size:10.0pt'> {<o:p></o:p></span></p><p class=MsoNormal><span lang=EN-US style='font-size:10.0pt'> perror("timer_settime");<o:p></o:p></span></p><p class=MsoNormal><span lang=EN-US style='font-size:10.0pt'> }<o:p></o:p></span></p><p class=MsoNormal><span lang=EN-US style='font-size:10.0pt'> <o:p></o:p></span></p><p class=MsoNormal><span lang=EN-US style='font-size:10.0pt'>////////////////////////////////////////////////////////////////////////////////<o:p></o:p></span></p><p class=MsoNormal><span lang=EN-US style='font-size:10.0pt'> <o:p></o:p></span></p><p class=MsoNormal><span lang=EN-US style='font-size:10.0pt'> for (i=0; i<SOCKET_MAX; i++){<o:p></o:p></span></p><p class=MsoNormal><span lang=EN-US style='font-size:10.0pt'> skt[i] = -1;<o:p></o:p></span></p><p class=MsoNormal><span lang=EN-US style='font-size:10.0pt'> }<o:p></o:p></span></p><p class=MsoNormal><span lang=EN-US style='font-size:10.0pt'> <o:p></o:p></span></p><p class=MsoNormal><span lang=EN-US style='font-size:10.0pt'> if ((skt[0] = socket(AF_INET, SOCK_STREAM, 0)) == -1) {<o:p></o:p></span></p><p class=MsoNormal><span lang=EN-US style='font-size:10.0pt'> printf("socket error...\n");<o:p></o:p></span></p><p class=MsoNormal><span lang=EN-US style='font-size:10.0pt'> return 0; <o:p></o:p></span></p><p class=MsoNormal><span lang=EN-US style='font-size:10.0pt'> }<o:p></o:p></span></p><p class=MsoNormal><span lang=EN-US style='font-size:10.0pt'> <o:p></o:p></span></p><p class=MsoNormal><span lang=EN-US style='font-size:10.0pt'> bzero((char*)&saddr, sizeof(saddr));<o:p></o:p></span></p><p class=MsoNormal><span lang=EN-US style='font-size:10.0pt'> saddr.sin_family = AF_INET;<o:p></o:p></span></p><p class=MsoNormal><span lang=EN-US style='font-size:10.0pt'> saddr.sin_addr.s_addr = INADDR_ANY;<o:p></o:p></span></p><p class=MsoNormal><span lang=EN-US style='font-size:10.0pt'> saddr.sin_port = htons(PORTNO);<o:p></o:p></span></p><p class=MsoNormal><span lang=EN-US style='font-size:10.0pt'> <o:p></o:p></span></p><p class=MsoNormal><span lang=EN-US style='font-size:10.0pt'> if((bind(skt[0], (struct sockaddr *)&saddr, sizeof(saddr))) == -1){<o:p></o:p></span></p><p class=MsoNormal><span lang=EN-US style='font-size:10.0pt'> printf("bind error...\n");<o:p></o:p></span></p><p class=MsoNormal><span lang=EN-US style='font-size:10.0pt'> return 0; <o:p></o:p></span></p><p class=MsoNormal><span lang=EN-US style='font-size:10.0pt'> }<o:p></o:p></span></p><p class=MsoNormal><span lang=EN-US style='font-size:10.0pt'> <o:p></o:p></span></p><p class=MsoNormal><span lang=EN-US style='font-size:10.0pt'> if ((listen(skt[0], SOCKET_MAX)) == -1){<o:p></o:p></span></p><p class=MsoNormal><span lang=EN-US style='font-size:10.0pt'> printf("listen error...\n");<o:p></o:p></span></p><p class=MsoNormal><span lang=EN-US style='font-size:10.0pt'> return 0; <o:p></o:p></span></p><p class=MsoNormal><span lang=EN-US style='font-size:10.0pt'> } <o:p></o:p></span></p><p class=MsoNormal><span lang=EN-US style='font-size:10.0pt'> <o:p></o:p></span></p><p class=MsoNormal><span lang=EN-US style='font-size:10.0pt'> timeout.tv_sec = 0;<o:p></o:p></span></p><p class=MsoNormal><span lang=EN-US style='font-size:10.0pt'> timeout.tv_usec = 0;<o:p></o:p></span></p><p class=MsoNormal><span lang=EN-US style='font-size:10.0pt'> pTimeval = &timeout;<o:p></o:p></span></p><p class=MsoNormal><span lang=EN-US style='font-size:10.0pt'> <o:p></o:p></span></p><p class=MsoNormal><span lang=EN-US style='font-size:10.0pt'> while(1){<o:p></o:p></span></p><p class=MsoNormal><span lang=EN-US style='font-size:10.0pt'> <o:p></o:p></span></p><p class=MsoNormal><span lang=EN-US style='font-size:10.0pt'> SubModule(); // </span><span style='font-size:10.0pt;font-family:"$B#M#S(B $B%4%7%C%/(B"'>$B>o;~JL$N:n6H$r9T$&!#(B</span><span lang=EN-US style='font-size:10.0pt'><o:p></o:p></span></p><p class=MsoNormal><span lang=EN-US style='font-size:10.0pt'> <o:p></o:p></span></p><p class=MsoNormal><span lang=EN-US style='font-size:10.0pt'> FD_ZERO(&readfds);<o:p></o:p></span></p><p class=MsoNormal><span lang=EN-US style='font-size:10.0pt'> for (i=0; i<SOCKET_MAX; i++){<o:p></o:p></span></p><p class=MsoNormal><span lang=EN-US style='font-size:10.0pt'> if (skt[i] != -1){<o:p></o:p></span></p><p class=MsoNormal><span lang=EN-US style='font-size:10.0pt'> FD_SET(skt[i], &readfds);<o:p></o:p></span></p><p class=MsoNormal><span lang=EN-US style='font-size:10.0pt'> }<o:p></o:p></span></p><p class=MsoNormal><span lang=EN-US style='font-size:10.0pt'> }<o:p></o:p></span></p><p class=MsoNormal><span lang=EN-US style='font-size:10.0pt'><o:p> </o:p></span></p><p class=MsoNormal><span lang=EN-US style='font-size:10.0pt'> res = select(FD_SETSIZE, &readfds, NULL, NULL, pTimeval);<o:p></o:p></span></p><p class=MsoNormal><span lang=EN-US style='font-size:10.0pt'><o:p> </o:p></span></p><p class=MsoNormal><span lang=EN-US style='font-size:10.0pt'> if (res == -1){<o:p></o:p></span></p><p class=MsoNormal><span lang=EN-US style='font-size:10.0pt'> printf("Error\n");<o:p></o:p></span></p><p class=MsoNormal><span lang=EN-US style='font-size:10.0pt'> }<o:p></o:p></span></p><p class=MsoNormal><span lang=EN-US style='font-size:10.0pt'> if(res == 0) {<o:p></o:p></span></p><p class=MsoNormal><span lang=EN-US style='font-size:10.0pt'> timeout.tv_sec = 0;<o:p></o:p></span></p><p class=MsoNormal><span lang=EN-US style='font-size:10.0pt'> timeout.tv_usec = 0;<o:p></o:p></span></p><p class=MsoNormal><span lang=EN-US style='font-size:10.0pt'> pTimeval = &timeout;<o:p></o:p></span></p><p class=MsoNormal><span lang=EN-US style='font-size:10.0pt'> }<o:p></o:p></span></p><p class=MsoNormal><span lang=EN-US style='font-size:10.0pt'> else{<o:p></o:p></span></p><p class=MsoNormal><span lang=EN-US style='font-size:10.0pt'> if (skt[1] != -1){<o:p></o:p></span></p><p class=MsoNormal><span lang=EN-US style='font-size:10.0pt'> if (FD_ISSET(skt[1], &readfds)){<o:p></o:p></span></p><p class=MsoNormal><span lang=EN-US style='font-size:10.0pt'> ack = read(skt[1], &buf, sizeof(buf));<o:p></o:p></span></p><p class=MsoNormal><span lang=EN-US style='font-size:10.0pt'> }<o:p></o:p></span></p><p class=MsoNormal><span lang=EN-US style='font-size:10.0pt'> }<o:p></o:p></span></p><p class=MsoNormal><span lang=EN-US style='font-size:10.0pt'> if (FD_ISSET(skt[0], &readfds)){<o:p></o:p></span></p><p class=MsoNormal><span lang=EN-US style='font-size:10.0pt'> sf = Accept(skt[0], (struct sockaddr*)&caddr);<o:p></o:p></span></p><p class=MsoNormal><span lang=EN-US style='font-size:10.0pt'> if (sf != -1){<o:p></o:p></span></p><p class=MsoNormal><span lang=EN-US style='font-size:10.0pt'> if (skt[1] != -1){<o:p></o:p></span></p><p class=MsoNormal><span lang=EN-US style='font-size:10.0pt'> shutdown(skt[1], 2);<o:p></o:p></span></p><p class=MsoNormal><span lang=EN-US style='font-size:10.0pt'> ack = CLOSE_SOCKET(skt[1]);<o:p></o:p></span></p><p class=MsoNormal><span lang=EN-US style='font-size:10.0pt'> }<o:p></o:p></span></p><p class=MsoNormal><span lang=EN-US style='font-size:10.0pt'> skt[1] = sf;<o:p></o:p></span></p><p class=MsoNormal><span lang=EN-US style='font-size:10.0pt'> }<o:p></o:p></span></p><p class=MsoNormal><span lang=EN-US style='font-size:10.0pt'> }<o:p></o:p></span></p><p class=MsoNormal><span lang=EN-US style='font-size:10.0pt'> }<o:p></o:p></span></p><p class=MsoNormal><span lang=EN-US style='font-size:10.0pt'> }<o:p></o:p></span></p><p class=MsoNormal><span lang=EN-US style='font-size:10.0pt'><o:p> </o:p></span></p><p class=MsoNormal><span lang=EN-US style='font-size:10.0pt'> shutdown(skt[0], 2);<o:p></o:p></span></p><p class=MsoNormal><span lang=EN-US style='font-size:10.0pt'> ack = CLOSE_SOCKET(skt[0]);<o:p></o:p></span></p><p class=MsoNormal><span lang=EN-US style='font-size:10.0pt'><o:p> </o:p></span></p><p class=MsoNormal><span lang=EN-US style='font-size:10.0pt'> return(0);<o:p></o:p></span></p><p class=MsoNormal><span lang=EN-US style='font-size:10.0pt'><o:p> </o:p></span></p><p class=MsoNormal><span lang=EN-US style='font-size:10.0pt'>}<o:p></o:p></span></p><p class=MsoNormal><span lang=EN-US style='font-size:10.0pt'><o:p> </o:p></span></p><p class=MsoNormal><span lang=EN-US style='font-size:10.0pt'><o:p> </o:p></span></p></div></body></html>