ich weiß nicht, was mein Problem ist... und bitte um Rat.
Also, ich schreibe eine Server/Client Anwendung. Und das Problem liegt bei dem Server:
Hier ist die Main Funktion (Da stimmt alles):
Code: Alles auswählen
int main()
{
    Socket sock1;
    sock1.create();
    sock1.bind( makeInt(sInfo.serverPort) );
    sock1.listen();
    while (true)
    {
        Socket* tmp_sock = new Socket();
        sock1.accept( *tmp_sock );
        pthread_t b;
        pthread_create(&b, NULL, newCommand, (void*) tmp_sock);
    }
    return 0;
}Dieser Code hiner funktioniert!:
Code: Alles auswählen
void* newCommand(void* p)
{
    pthread_detach(pthread_self());
    Socket* sock = (Socket*) p;
    string req;
    sock->setTimeout(5);
    sock->recv (req);
    cout << req;
    delete sock;
    return NULL;
}Code: Alles auswählen
void* newCommand(void* p)
{
    pthread_detach(pthread_self());
    Socket* sock = (Socket*) p;
    string req;
    sock->setTimeout(5);
    sock->recv (req);
    cout << req.length();
    delete sock;
    return NULL;
}
