\doxysection{example\+\_\+server.\+c}
\hypertarget{example__server_8c_source}{}\label{example__server_8c_source}\index{example\_server.c@{example\_server.c}}

\begin{DoxyCode}{0}
\DoxyCodeLine{\Hypertarget{example__server_8c_source_l00001}00001\ \textcolor{comment}{/*}}
\DoxyCodeLine{\Hypertarget{example__server_8c_source_l00002}00002\ \textcolor{comment}{\ *\ \ Copyright\ (C)\ 2014\ Steve\ Harris\ et\ al.\ (see\ AUTHORS)}}
\DoxyCodeLine{\Hypertarget{example__server_8c_source_l00003}00003\ \textcolor{comment}{\ *}}
\DoxyCodeLine{\Hypertarget{example__server_8c_source_l00004}00004\ \textcolor{comment}{\ *\ \ This\ program\ is\ free\ software;\ you\ can\ redistribute\ it\ and/or\ modify}}
\DoxyCodeLine{\Hypertarget{example__server_8c_source_l00005}00005\ \textcolor{comment}{\ *\ \ it\ under\ the\ terms\ of\ the\ GNU\ Lesser\ General\ Public\ License\ as}}
\DoxyCodeLine{\Hypertarget{example__server_8c_source_l00006}00006\ \textcolor{comment}{\ *\ \ published\ by\ the\ Free\ Software\ Foundation;\ either\ version\ 2.1\ of\ the}}
\DoxyCodeLine{\Hypertarget{example__server_8c_source_l00007}00007\ \textcolor{comment}{\ *\ \ License,\ or\ (at\ your\ option)\ any\ later\ version.}}
\DoxyCodeLine{\Hypertarget{example__server_8c_source_l00008}00008\ \textcolor{comment}{\ *}}
\DoxyCodeLine{\Hypertarget{example__server_8c_source_l00009}00009\ \textcolor{comment}{\ *\ \ This\ program\ is\ distributed\ in\ the\ hope\ that\ it\ will\ be\ useful,}}
\DoxyCodeLine{\Hypertarget{example__server_8c_source_l00010}00010\ \textcolor{comment}{\ *\ \ but\ WITHOUT\ ANY\ WARRANTY;\ without\ even\ the\ implied\ warranty\ of}}
\DoxyCodeLine{\Hypertarget{example__server_8c_source_l00011}00011\ \textcolor{comment}{\ *\ \ MERCHANTABILITY\ or\ FITNESS\ FOR\ A\ PARTICULAR\ PURPOSE.\ \ See\ the}}
\DoxyCodeLine{\Hypertarget{example__server_8c_source_l00012}00012\ \textcolor{comment}{\ *\ \ GNU\ Lesser\ General\ Public\ License\ for\ more\ details.}}
\DoxyCodeLine{\Hypertarget{example__server_8c_source_l00013}00013\ \textcolor{comment}{\ *}}
\DoxyCodeLine{\Hypertarget{example__server_8c_source_l00014}00014\ \textcolor{comment}{\ *\ \ \$Id\$}}
\DoxyCodeLine{\Hypertarget{example__server_8c_source_l00015}00015\ \textcolor{comment}{\ */}}
\DoxyCodeLine{\Hypertarget{example__server_8c_source_l00016}00016\ }
\DoxyCodeLine{\Hypertarget{example__server_8c_source_l00017}00017\ \textcolor{preprocessor}{\#include\ <stdio.h>}}
\DoxyCodeLine{\Hypertarget{example__server_8c_source_l00018}00018\ \textcolor{preprocessor}{\#include\ <stdlib.h>}}
\DoxyCodeLine{\Hypertarget{example__server_8c_source_l00019}00019\ \textcolor{preprocessor}{\#ifndef\ WIN32}}
\DoxyCodeLine{\Hypertarget{example__server_8c_source_l00020}00020\ \textcolor{preprocessor}{\#\ include\ <unistd.h>}}
\DoxyCodeLine{\Hypertarget{example__server_8c_source_l00021}00021\ \textcolor{preprocessor}{\#endif}}
\DoxyCodeLine{\Hypertarget{example__server_8c_source_l00022}00022\ \textcolor{preprocessor}{\#include\ "{}\doxymbox{\hyperlink{lo_8h}{lo/lo.h}}"{}}}
\DoxyCodeLine{\Hypertarget{example__server_8c_source_l00023}00023\ }
\DoxyCodeLine{\Hypertarget{example__server_8c_source_l00024}00024\ \textcolor{keywordtype}{int}\ done\ =\ 0;}
\DoxyCodeLine{\Hypertarget{example__server_8c_source_l00025}00025\ }
\DoxyCodeLine{\Hypertarget{example__server_8c_source_l00026}00026\ \textcolor{keywordtype}{void}\ error(\textcolor{keywordtype}{int}\ num,\ \textcolor{keyword}{const}\ \textcolor{keywordtype}{char}\ *m,\ \textcolor{keyword}{const}\ \textcolor{keywordtype}{char}\ *path);}
\DoxyCodeLine{\Hypertarget{example__server_8c_source_l00027}00027\ }
\DoxyCodeLine{\Hypertarget{example__server_8c_source_l00028}00028\ \textcolor{keywordtype}{int}\ generic\_handler(\textcolor{keyword}{const}\ \textcolor{keywordtype}{char}\ *path,\ \textcolor{keyword}{const}\ \textcolor{keywordtype}{char}\ *types,\ \doxymbox{\hyperlink{unionlo__arg}{lo\_arg}}\ **\ argv,}
\DoxyCodeLine{\Hypertarget{example__server_8c_source_l00029}00029\ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \textcolor{keywordtype}{int}\ argc,\ \doxymbox{\hyperlink{lo__types_8h_a50be181dde1a8d313dbc7e48d4032210}{lo\_message}}\ data,\ \textcolor{keywordtype}{void}\ *user\_data);}
\DoxyCodeLine{\Hypertarget{example__server_8c_source_l00030}00030\ }
\DoxyCodeLine{\Hypertarget{example__server_8c_source_l00031}00031\ \textcolor{keywordtype}{int}\ foo\_handler(\textcolor{keyword}{const}\ \textcolor{keywordtype}{char}\ *path,\ \textcolor{keyword}{const}\ \textcolor{keywordtype}{char}\ *types,\ \doxymbox{\hyperlink{unionlo__arg}{lo\_arg}}\ **\ argv,}
\DoxyCodeLine{\Hypertarget{example__server_8c_source_l00032}00032\ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \textcolor{keywordtype}{int}\ argc,\ \doxymbox{\hyperlink{lo__types_8h_a50be181dde1a8d313dbc7e48d4032210}{lo\_message}}\ data,\ \textcolor{keywordtype}{void}\ *user\_data);}
\DoxyCodeLine{\Hypertarget{example__server_8c_source_l00033}00033\ }
\DoxyCodeLine{\Hypertarget{example__server_8c_source_l00034}00034\ \textcolor{keywordtype}{int}\ blobtest\_handler(\textcolor{keyword}{const}\ \textcolor{keywordtype}{char}\ *path,\ \textcolor{keyword}{const}\ \textcolor{keywordtype}{char}\ *types,\ \doxymbox{\hyperlink{unionlo__arg}{lo\_arg}}\ **\ argv,}
\DoxyCodeLine{\Hypertarget{example__server_8c_source_l00035}00035\ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \textcolor{keywordtype}{int}\ argc,\ \doxymbox{\hyperlink{lo__types_8h_a50be181dde1a8d313dbc7e48d4032210}{lo\_message}}\ data,\ \textcolor{keywordtype}{void}\ *user\_data);}
\DoxyCodeLine{\Hypertarget{example__server_8c_source_l00036}00036\ }
\DoxyCodeLine{\Hypertarget{example__server_8c_source_l00037}00037\ \textcolor{keywordtype}{int}\ pattern\_handler(\textcolor{keyword}{const}\ \textcolor{keywordtype}{char}\ *path,\ \textcolor{keyword}{const}\ \textcolor{keywordtype}{char}\ *types,\ \doxymbox{\hyperlink{unionlo__arg}{lo\_arg}}\ **\ argv,}
\DoxyCodeLine{\Hypertarget{example__server_8c_source_l00038}00038\ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \textcolor{keywordtype}{int}\ argc,\ \doxymbox{\hyperlink{lo__types_8h_a50be181dde1a8d313dbc7e48d4032210}{lo\_message}}\ data,\ \textcolor{keywordtype}{void}\ *user\_data);}
\DoxyCodeLine{\Hypertarget{example__server_8c_source_l00039}00039\ }
\DoxyCodeLine{\Hypertarget{example__server_8c_source_l00040}00040\ \textcolor{keywordtype}{int}\ quit\_handler(\textcolor{keyword}{const}\ \textcolor{keywordtype}{char}\ *path,\ \textcolor{keyword}{const}\ \textcolor{keywordtype}{char}\ *types,\ \doxymbox{\hyperlink{unionlo__arg}{lo\_arg}}\ **\ argv,}
\DoxyCodeLine{\Hypertarget{example__server_8c_source_l00041}00041\ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \textcolor{keywordtype}{int}\ argc,\ \doxymbox{\hyperlink{lo__types_8h_a50be181dde1a8d313dbc7e48d4032210}{lo\_message}}\ data,\ \textcolor{keywordtype}{void}\ *user\_data);}
\DoxyCodeLine{\Hypertarget{example__server_8c_source_l00042}00042\ }
\DoxyCodeLine{\Hypertarget{example__server_8c_source_l00043}00043\ \textcolor{keywordtype}{int}\ main()}
\DoxyCodeLine{\Hypertarget{example__server_8c_source_l00044}00044\ \{}
\DoxyCodeLine{\Hypertarget{example__server_8c_source_l00045}00045\ \ \ \ \ \textcolor{comment}{/*\ start\ a\ new\ server\ on\ port\ 7770\ */}}
\DoxyCodeLine{\Hypertarget{example__server_8c_source_l00046}00046\ \ \ \ \ \doxymbox{\hyperlink{lo__types_8h_ade4a4a955cce22c288e0b1b756e4b1cb}{lo\_server\_thread}}\ st\ =\ \doxymbox{\hyperlink{lo__serverthread_8h_abe3e0c31189adfd7624de6c507b610ba}{lo\_server\_thread\_new}}(\textcolor{stringliteral}{"{}7770"{}},\ error);}
\DoxyCodeLine{\Hypertarget{example__server_8c_source_l00047}00047\ }
\DoxyCodeLine{\Hypertarget{example__server_8c_source_l00048}00048\ \ \ \ \ \textcolor{comment}{/*\ add\ method\ that\ will\ match\ any\ path\ and\ args\ */}}
\DoxyCodeLine{\Hypertarget{example__server_8c_source_l00049}00049\ \ \ \ \ \doxymbox{\hyperlink{lo__serverthread_8h_af500729c76fd5bb4798d350b6307adc1}{lo\_server\_thread\_add\_method}}(st,\ NULL,\ NULL,\ generic\_handler,\ NULL);}
\DoxyCodeLine{\Hypertarget{example__server_8c_source_l00050}00050\ }
\DoxyCodeLine{\Hypertarget{example__server_8c_source_l00051}00051\ \ \ \ \ \textcolor{comment}{/*\ add\ method\ that\ will\ match\ the\ path\ /foo/bar,\ with\ two\ numbers,\ coerced}}
\DoxyCodeLine{\Hypertarget{example__server_8c_source_l00052}00052\ \textcolor{comment}{\ \ \ \ \ *\ to\ float\ and\ int\ */}}
\DoxyCodeLine{\Hypertarget{example__server_8c_source_l00053}00053\ \ \ \ \ \doxymbox{\hyperlink{lo__serverthread_8h_af500729c76fd5bb4798d350b6307adc1}{lo\_server\_thread\_add\_method}}(st,\ \textcolor{stringliteral}{"{}/foo/bar"{}},\ \textcolor{stringliteral}{"{}fi"{}},\ foo\_handler,\ NULL);}
\DoxyCodeLine{\Hypertarget{example__server_8c_source_l00054}00054\ }
\DoxyCodeLine{\Hypertarget{example__server_8c_source_l00055}00055\ \ \ \ \ \textcolor{comment}{/*\ add\ method\ that\ will\ match\ the\ path\ /blobtest\ with\ one\ blob\ arg\ */}}
\DoxyCodeLine{\Hypertarget{example__server_8c_source_l00056}00056\ \ \ \ \ \doxymbox{\hyperlink{lo__serverthread_8h_af500729c76fd5bb4798d350b6307adc1}{lo\_server\_thread\_add\_method}}(st,\ \textcolor{stringliteral}{"{}/blobtest"{}},\ \textcolor{stringliteral}{"{}b"{}},\ blobtest\_handler,\ NULL);}
\DoxyCodeLine{\Hypertarget{example__server_8c_source_l00057}00057\ }
\DoxyCodeLine{\Hypertarget{example__server_8c_source_l00058}00058\ \ \ \ \ \textcolor{comment}{/*\ catch\ any\ message\ starting\ with\ /g\ using\ a\ pattern\ method\ */}}
\DoxyCodeLine{\Hypertarget{example__server_8c_source_l00059}00059\ \ \ \ \ \doxymbox{\hyperlink{lo__serverthread_8h_af500729c76fd5bb4798d350b6307adc1}{lo\_server\_thread\_add\_method}}(st,\ \textcolor{stringliteral}{"{}/p*"{}},\ \textcolor{stringliteral}{"{}"{}},\ pattern\_handler,\ NULL);}
\DoxyCodeLine{\Hypertarget{example__server_8c_source_l00060}00060\ }
\DoxyCodeLine{\Hypertarget{example__server_8c_source_l00061}00061\ \ \ \ \ \textcolor{comment}{/*\ also\ catch\ "{}/q*"{},\ but\ glob\_handle\ returns\ 1,\ so\ quit\_handler}}
\DoxyCodeLine{\Hypertarget{example__server_8c_source_l00062}00062\ \textcolor{comment}{\ \ \ \ \ *\ gets\ called\ after\ */}}
\DoxyCodeLine{\Hypertarget{example__server_8c_source_l00063}00063\ \ \ \ \ \doxymbox{\hyperlink{lo__serverthread_8h_af500729c76fd5bb4798d350b6307adc1}{lo\_server\_thread\_add\_method}}(st,\ \textcolor{stringliteral}{"{}/q*"{}},\ \textcolor{stringliteral}{"{}"{}},\ pattern\_handler,\ NULL);}
\DoxyCodeLine{\Hypertarget{example__server_8c_source_l00064}00064\ }
\DoxyCodeLine{\Hypertarget{example__server_8c_source_l00065}00065\ \ \ \ \ \textcolor{comment}{/*\ add\ method\ that\ will\ match\ the\ path\ /quit\ with\ no\ args\ */}}
\DoxyCodeLine{\Hypertarget{example__server_8c_source_l00066}00066\ \ \ \ \ \doxymbox{\hyperlink{lo__serverthread_8h_af500729c76fd5bb4798d350b6307adc1}{lo\_server\_thread\_add\_method}}(st,\ \textcolor{stringliteral}{"{}/quit"{}},\ \textcolor{stringliteral}{"{}"{}},\ quit\_handler,\ NULL);}
\DoxyCodeLine{\Hypertarget{example__server_8c_source_l00067}00067\ }
\DoxyCodeLine{\Hypertarget{example__server_8c_source_l00068}00068\ \ \ \ \ \doxymbox{\hyperlink{lo__serverthread_8h_a4b284c1b96d0354c5de4ff7ba5a44fbc}{lo\_server\_thread\_start}}(st);}
\DoxyCodeLine{\Hypertarget{example__server_8c_source_l00069}00069\ }
\DoxyCodeLine{\Hypertarget{example__server_8c_source_l00070}00070\ \ \ \ \ \textcolor{keywordflow}{while}\ (!done)\ \{}
\DoxyCodeLine{\Hypertarget{example__server_8c_source_l00071}00071\ \textcolor{preprocessor}{\#ifdef\ WIN32}}
\DoxyCodeLine{\Hypertarget{example__server_8c_source_l00072}00072\ \ \ \ \ \ \ \ \ Sleep(1);}
\DoxyCodeLine{\Hypertarget{example__server_8c_source_l00073}00073\ \textcolor{preprocessor}{\#else}}
\DoxyCodeLine{\Hypertarget{example__server_8c_source_l00074}00074\ \ \ \ \ \ \ \ \ usleep(1000);}
\DoxyCodeLine{\Hypertarget{example__server_8c_source_l00075}00075\ \textcolor{preprocessor}{\#endif}}
\DoxyCodeLine{\Hypertarget{example__server_8c_source_l00076}00076\ \ \ \ \ \}}
\DoxyCodeLine{\Hypertarget{example__server_8c_source_l00077}00077\ }
\DoxyCodeLine{\Hypertarget{example__server_8c_source_l00078}00078\ \ \ \ \ \doxymbox{\hyperlink{lo__serverthread_8h_ad72be3f2a81b9583ad69dd007080c0e5}{lo\_server\_thread\_free}}(st);}
\DoxyCodeLine{\Hypertarget{example__server_8c_source_l00079}00079\ }
\DoxyCodeLine{\Hypertarget{example__server_8c_source_l00080}00080\ \ \ \ \ \textcolor{keywordflow}{return}\ 0;}
\DoxyCodeLine{\Hypertarget{example__server_8c_source_l00081}00081\ \}}
\DoxyCodeLine{\Hypertarget{example__server_8c_source_l00082}00082\ }
\DoxyCodeLine{\Hypertarget{example__server_8c_source_l00083}00083\ \textcolor{keywordtype}{void}\ error(\textcolor{keywordtype}{int}\ num,\ \textcolor{keyword}{const}\ \textcolor{keywordtype}{char}\ *msg,\ \textcolor{keyword}{const}\ \textcolor{keywordtype}{char}\ *path)}
\DoxyCodeLine{\Hypertarget{example__server_8c_source_l00084}00084\ \{}
\DoxyCodeLine{\Hypertarget{example__server_8c_source_l00085}00085\ \ \ \ \ printf(\textcolor{stringliteral}{"{}liblo\ server\ error\ \%d\ in\ path\ \%s:\ \%s\(\backslash\)n"{}},\ num,\ path,\ msg);}
\DoxyCodeLine{\Hypertarget{example__server_8c_source_l00086}00086\ \ \ \ \ fflush(stdout);}
\DoxyCodeLine{\Hypertarget{example__server_8c_source_l00087}00087\ \}}
\DoxyCodeLine{\Hypertarget{example__server_8c_source_l00088}00088\ }
\DoxyCodeLine{\Hypertarget{example__server_8c_source_l00089}00089\ \textcolor{comment}{/*\ catch\ any\ incoming\ messages\ and\ display\ them.\ returning\ 1\ means\ that\ the}}
\DoxyCodeLine{\Hypertarget{example__server_8c_source_l00090}00090\ \textcolor{comment}{\ *\ message\ has\ not\ been\ fully\ handled\ and\ the\ server\ should\ try\ other\ methods\ */}}
\DoxyCodeLine{\Hypertarget{example__server_8c_source_l00091}00091\ \textcolor{keywordtype}{int}\ generic\_handler(\textcolor{keyword}{const}\ \textcolor{keywordtype}{char}\ *path,\ \textcolor{keyword}{const}\ \textcolor{keywordtype}{char}\ *types,\ \doxymbox{\hyperlink{unionlo__arg}{lo\_arg}}\ **\ argv,}
\DoxyCodeLine{\Hypertarget{example__server_8c_source_l00092}00092\ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \textcolor{keywordtype}{int}\ argc,\ \doxymbox{\hyperlink{lo__types_8h_a50be181dde1a8d313dbc7e48d4032210}{lo\_message}}\ data,\ \textcolor{keywordtype}{void}\ *user\_data)}
\DoxyCodeLine{\Hypertarget{example__server_8c_source_l00093}00093\ \{}
\DoxyCodeLine{\Hypertarget{example__server_8c_source_l00094}00094\ \ \ \ \ \textcolor{keywordtype}{int}\ i;}
\DoxyCodeLine{\Hypertarget{example__server_8c_source_l00095}00095\ }
\DoxyCodeLine{\Hypertarget{example__server_8c_source_l00096}00096\ \ \ \ \ printf(\textcolor{stringliteral}{"{}generic\ handler;\ path:\ <\%s>\(\backslash\)n"{}},\ path);}
\DoxyCodeLine{\Hypertarget{example__server_8c_source_l00097}00097\ \ \ \ \ \textcolor{keywordflow}{for}\ (i\ =\ 0;\ i\ <\ argc;\ i++)\ \{}
\DoxyCodeLine{\Hypertarget{example__server_8c_source_l00098}00098\ \ \ \ \ \ \ \ \ printf(\textcolor{stringliteral}{"{}arg\ \%d\ '\%c'\ "{}},\ i,\ types[i]);}
\DoxyCodeLine{\Hypertarget{example__server_8c_source_l00099}00099\ \ \ \ \ \ \ \ \ \doxymbox{\hyperlink{group__pp_ga1699678a3a2d4221bb55fa2e05326ef0}{lo\_arg\_pp}}((\doxymbox{\hyperlink{group__liblo_ga11838c576b0197c255ce805fd7434736}{lo\_type}})types[i],\ argv[i]);}
\DoxyCodeLine{\Hypertarget{example__server_8c_source_l00100}00100\ \ \ \ \ \ \ \ \ printf(\textcolor{stringliteral}{"{}\(\backslash\)n"{}});}
\DoxyCodeLine{\Hypertarget{example__server_8c_source_l00101}00101\ \ \ \ \ \}}
\DoxyCodeLine{\Hypertarget{example__server_8c_source_l00102}00102\ \ \ \ \ printf(\textcolor{stringliteral}{"{}\(\backslash\)n"{}});}
\DoxyCodeLine{\Hypertarget{example__server_8c_source_l00103}00103\ \ \ \ \ fflush(stdout);}
\DoxyCodeLine{\Hypertarget{example__server_8c_source_l00104}00104\ }
\DoxyCodeLine{\Hypertarget{example__server_8c_source_l00105}00105\ \ \ \ \ \textcolor{keywordflow}{return}\ 1;}
\DoxyCodeLine{\Hypertarget{example__server_8c_source_l00106}00106\ \}}
\DoxyCodeLine{\Hypertarget{example__server_8c_source_l00107}00107\ }
\DoxyCodeLine{\Hypertarget{example__server_8c_source_l00108}00108\ \textcolor{keywordtype}{int}\ foo\_handler(\textcolor{keyword}{const}\ \textcolor{keywordtype}{char}\ *path,\ \textcolor{keyword}{const}\ \textcolor{keywordtype}{char}\ *types,\ \doxymbox{\hyperlink{unionlo__arg}{lo\_arg}}\ **\ argv,}
\DoxyCodeLine{\Hypertarget{example__server_8c_source_l00109}00109\ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \textcolor{keywordtype}{int}\ argc,\ \doxymbox{\hyperlink{lo__types_8h_a50be181dde1a8d313dbc7e48d4032210}{lo\_message}}\ data,\ \textcolor{keywordtype}{void}\ *user\_data)}
\DoxyCodeLine{\Hypertarget{example__server_8c_source_l00110}00110\ \{}
\DoxyCodeLine{\Hypertarget{example__server_8c_source_l00111}00111\ \ \ \ \ \textcolor{comment}{/*\ example\ showing\ pulling\ the\ argument\ values\ out\ of\ the\ argv\ array\ */}}
\DoxyCodeLine{\Hypertarget{example__server_8c_source_l00112}00112\ \ \ \ \ printf(\textcolor{stringliteral}{"{}foo:\ \%s\ <-\/\ f:\%f,\ i:\%d\(\backslash\)n\(\backslash\)n"{}},\ path,\ argv[0]-\/>f,\ argv[1]-\/>i);}
\DoxyCodeLine{\Hypertarget{example__server_8c_source_l00113}00113\ \ \ \ \ fflush(stdout);}
\DoxyCodeLine{\Hypertarget{example__server_8c_source_l00114}00114\ }
\DoxyCodeLine{\Hypertarget{example__server_8c_source_l00115}00115\ \ \ \ \ \textcolor{keywordflow}{return}\ 0;}
\DoxyCodeLine{\Hypertarget{example__server_8c_source_l00116}00116\ \}}
\DoxyCodeLine{\Hypertarget{example__server_8c_source_l00117}00117\ }
\DoxyCodeLine{\Hypertarget{example__server_8c_source_l00118}00118\ \textcolor{keywordtype}{int}\ blobtest\_handler(\textcolor{keyword}{const}\ \textcolor{keywordtype}{char}\ *path,\ \textcolor{keyword}{const}\ \textcolor{keywordtype}{char}\ *types,\ \doxymbox{\hyperlink{unionlo__arg}{lo\_arg}}\ **\ argv,}
\DoxyCodeLine{\Hypertarget{example__server_8c_source_l00119}00119\ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \textcolor{keywordtype}{int}\ argc,\ \doxymbox{\hyperlink{lo__types_8h_a50be181dde1a8d313dbc7e48d4032210}{lo\_message}}\ data,\ \textcolor{keywordtype}{void}\ *user\_data)}
\DoxyCodeLine{\Hypertarget{example__server_8c_source_l00120}00120\ \{}
\DoxyCodeLine{\Hypertarget{example__server_8c_source_l00121}00121\ \ \ \ \ \textcolor{comment}{/*\ example\ showing\ how\ to\ get\ data\ for\ a\ blob\ */}}
\DoxyCodeLine{\Hypertarget{example__server_8c_source_l00122}00122\ \ \ \ \ \textcolor{keywordtype}{int}\ i,\ size\ =\ argv[0]-\/>\doxymbox{\hyperlink{unionlo__arg_a9cb8ccbf198097dd81d3722ceb0e7686}{blob}}.size;}
\DoxyCodeLine{\Hypertarget{example__server_8c_source_l00123}00123\ \ \ \ \ \textcolor{keywordtype}{char}\ mydata[6];}
\DoxyCodeLine{\Hypertarget{example__server_8c_source_l00124}00124\ }
\DoxyCodeLine{\Hypertarget{example__server_8c_source_l00125}00125\ \ \ \ \ \textcolor{keywordtype}{unsigned}\ \textcolor{keywordtype}{char}\ *blobdata\ =\ (\textcolor{keywordtype}{unsigned}\ \textcolor{keywordtype}{char}*)\doxymbox{\hyperlink{group__liblo_gac468d3de3ae93baa4d28199b1368874d}{lo\_blob\_dataptr}}((\doxymbox{\hyperlink{lo__types_8h_a8f2b43f1b0709fab80bedc5a63f277f2}{lo\_blob}})argv[0]);}
\DoxyCodeLine{\Hypertarget{example__server_8c_source_l00126}00126\ \ \ \ \ \textcolor{keywordtype}{int}\ blobsize\ =\ \doxymbox{\hyperlink{group__liblo_gab6c9184f0a54f19319d8a6409487b466}{lo\_blob\_datasize}}((\doxymbox{\hyperlink{lo__types_8h_a8f2b43f1b0709fab80bedc5a63f277f2}{lo\_blob}})argv[0]);}
\DoxyCodeLine{\Hypertarget{example__server_8c_source_l00127}00127\ }
\DoxyCodeLine{\Hypertarget{example__server_8c_source_l00128}00128\ \ \ \ \ \textcolor{comment}{/*\ Alternatively:}}
\DoxyCodeLine{\Hypertarget{example__server_8c_source_l00129}00129\ \textcolor{comment}{\ \ \ \ \ *\ blobdata\ =\ \&argv[0]-\/>blob.data;}}
\DoxyCodeLine{\Hypertarget{example__server_8c_source_l00130}00130\ \textcolor{comment}{\ \ \ \ \ *\ blobsize\ =\ argv[0]-\/>blob.size;}}
\DoxyCodeLine{\Hypertarget{example__server_8c_source_l00131}00131\ \textcolor{comment}{\ \ \ \ \ */}}
\DoxyCodeLine{\Hypertarget{example__server_8c_source_l00132}00132\ }
\DoxyCodeLine{\Hypertarget{example__server_8c_source_l00133}00133\ \ \ \ \ \textcolor{comment}{/*\ Don't\ trust\ network\ input!\ Blob\ can\ be\ anything,\ so\ check\ if}}
\DoxyCodeLine{\Hypertarget{example__server_8c_source_l00134}00134\ \textcolor{comment}{\ \ \ \ \ \ \ each\ character\ is\ a\ letter\ A-\/Z.\ */}}
\DoxyCodeLine{\Hypertarget{example__server_8c_source_l00135}00135\ \ \ \ \ \textcolor{keywordflow}{for}\ (i=0;\ i<6\ \&\&\ i<blobsize;\ i++)}
\DoxyCodeLine{\Hypertarget{example__server_8c_source_l00136}00136\ \ \ \ \ \ \ \ \ \textcolor{keywordflow}{if}\ (blobdata[i]\ >=\ \textcolor{charliteral}{'A'}\ \&\&\ blobdata[i]\ <=\ \textcolor{charliteral}{'Z'})}
\DoxyCodeLine{\Hypertarget{example__server_8c_source_l00137}00137\ \ \ \ \ \ \ \ \ \ \ \ \ mydata[i]\ =\ blobdata[i];}
\DoxyCodeLine{\Hypertarget{example__server_8c_source_l00138}00138\ \ \ \ \ \ \ \ \ \textcolor{keywordflow}{else}}
\DoxyCodeLine{\Hypertarget{example__server_8c_source_l00139}00139\ \ \ \ \ \ \ \ \ \ \ \ \ mydata[i]\ =\ \textcolor{charliteral}{'.'};}
\DoxyCodeLine{\Hypertarget{example__server_8c_source_l00140}00140\ \ \ \ \ mydata[5]\ =\ 0;}
\DoxyCodeLine{\Hypertarget{example__server_8c_source_l00141}00141\ }
\DoxyCodeLine{\Hypertarget{example__server_8c_source_l00142}00142\ \ \ \ \ printf(\textcolor{stringliteral}{"{}\%s\ <-\/\ length:\%d\ '\%s'\(\backslash\)n"{}},\ path,\ size,\ mydata);}
\DoxyCodeLine{\Hypertarget{example__server_8c_source_l00143}00143\ \ \ \ \ fflush(stdout);}
\DoxyCodeLine{\Hypertarget{example__server_8c_source_l00144}00144\ }
\DoxyCodeLine{\Hypertarget{example__server_8c_source_l00145}00145\ \ \ \ \ \textcolor{keywordflow}{return}\ 0;}
\DoxyCodeLine{\Hypertarget{example__server_8c_source_l00146}00146\ \}}
\DoxyCodeLine{\Hypertarget{example__server_8c_source_l00147}00147\ }
\DoxyCodeLine{\Hypertarget{example__server_8c_source_l00148}00148\ \textcolor{keywordtype}{int}\ pattern\_handler(\textcolor{keyword}{const}\ \textcolor{keywordtype}{char}\ *path,\ \textcolor{keyword}{const}\ \textcolor{keywordtype}{char}\ *types,\ \doxymbox{\hyperlink{unionlo__arg}{lo\_arg}}\ **\ argv,}
\DoxyCodeLine{\Hypertarget{example__server_8c_source_l00149}00149\ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \textcolor{keywordtype}{int}\ argc,\ \doxymbox{\hyperlink{lo__types_8h_a50be181dde1a8d313dbc7e48d4032210}{lo\_message}}\ data,\ \textcolor{keywordtype}{void}\ *user\_data)}
\DoxyCodeLine{\Hypertarget{example__server_8c_source_l00150}00150\ \{}
\DoxyCodeLine{\Hypertarget{example__server_8c_source_l00151}00151\ \ \ \ \ printf(\textcolor{stringliteral}{"{}pattern\ handler\ matched:\ \%s\(\backslash\)n\(\backslash\)n"{}},\ path);}
\DoxyCodeLine{\Hypertarget{example__server_8c_source_l00152}00152\ \ \ \ \ fflush(stdout);}
\DoxyCodeLine{\Hypertarget{example__server_8c_source_l00153}00153\ }
\DoxyCodeLine{\Hypertarget{example__server_8c_source_l00154}00154\ \ \ \ \ \textcolor{comment}{//\ Let\ the\ dispatcher\ continue\ by\ returning\ non-\/zero,\ so}}
\DoxyCodeLine{\Hypertarget{example__server_8c_source_l00155}00155\ \ \ \ \ \textcolor{comment}{//\ quit\_handler\ can\ also\ catch\ the\ message}}
\DoxyCodeLine{\Hypertarget{example__server_8c_source_l00156}00156\ \ \ \ \ \textcolor{keywordflow}{return}\ 1;}
\DoxyCodeLine{\Hypertarget{example__server_8c_source_l00157}00157\ \}}
\DoxyCodeLine{\Hypertarget{example__server_8c_source_l00158}00158\ }
\DoxyCodeLine{\Hypertarget{example__server_8c_source_l00159}00159\ \textcolor{keywordtype}{int}\ quit\_handler(\textcolor{keyword}{const}\ \textcolor{keywordtype}{char}\ *path,\ \textcolor{keyword}{const}\ \textcolor{keywordtype}{char}\ *types,\ \doxymbox{\hyperlink{unionlo__arg}{lo\_arg}}\ **\ argv,}
\DoxyCodeLine{\Hypertarget{example__server_8c_source_l00160}00160\ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \textcolor{keywordtype}{int}\ argc,\ \doxymbox{\hyperlink{lo__types_8h_a50be181dde1a8d313dbc7e48d4032210}{lo\_message}}\ data,\ \textcolor{keywordtype}{void}\ *user\_data)}
\DoxyCodeLine{\Hypertarget{example__server_8c_source_l00161}00161\ \{}
\DoxyCodeLine{\Hypertarget{example__server_8c_source_l00162}00162\ \ \ \ \ done\ =\ 1;}
\DoxyCodeLine{\Hypertarget{example__server_8c_source_l00163}00163\ \ \ \ \ printf(\textcolor{stringliteral}{"{}quiting\(\backslash\)n\(\backslash\)n"{}});}
\DoxyCodeLine{\Hypertarget{example__server_8c_source_l00164}00164\ \ \ \ \ fflush(stdout);}
\DoxyCodeLine{\Hypertarget{example__server_8c_source_l00165}00165\ }
\DoxyCodeLine{\Hypertarget{example__server_8c_source_l00166}00166\ \ \ \ \ \textcolor{keywordflow}{return}\ 0;}
\DoxyCodeLine{\Hypertarget{example__server_8c_source_l00167}00167\ \}}
\DoxyCodeLine{\Hypertarget{example__server_8c_source_l00168}00168\ }
\DoxyCodeLine{\Hypertarget{example__server_8c_source_l00169}00169\ \textcolor{comment}{/*\ vi:set\ ts=8\ sts=4\ sw=4:\ */}}

\end{DoxyCode}
