You need to use a server implementation that supports threads. Most languages' libraries provide a number of different server implementations, but you probably want something with ThreadPool in the name.
On Fri, Apr 8, 2011 at 6:22 AM, KK <[email protected]> wrote: > Hello, > > I am a new thrift user since about 24 hours and have to say: I am thrilled. > > While testing I have a scenario with a cpp server and a php client. > > The server has a function like > > void sayHello(string &ret, const string &name, const int32_t age) > { > > char buffer[2]; > sprintf(buffer, "%d", age); > > if (strcmp(name.data(), "ABC") == 0) > { > while(1){ usleep(1000); } > } > > ret.append("Hello "); > ret.append(name.c_str()); > ret.append(" ("); > ret.append(buffer); > ret.append(")"); > } > > and the client looks like the following > > $socket = new TSocket('192.168.3.72', 9090); > $transport = new TBufferedTransport($socket, 1024, 1024); > $protocol = new TBinaryProtocol($transport); > $client = new CalculatorClient($protocol); > > $transport->open(); > > $hello = $client->sayHello("Test", 99); > print $hello; > > $transport->close(); > > But when I copy the phpClient.php to phpClient2.php and uses "ABC" as name > for function "sayHello", the server will hang in that infinite loop and > will > not give access to phpClient.php where name is "Test" (TException: TSocket: > timed out reading 4 bytes from 192.168.3.72:9090). So the server is > blocked > by the client who opens function sayHello with parameter "ABC". > > Is there any possibility to make the server "multi-client-able" that every > client gets its own instance? > > Best regards, KK >
