send/recv from a thread..

Discuss the development of new homebrew software, tools and libraries.

Moderators: cheriff, TyRaNiD

Post Reply
israr
Posts: 5
Joined: Tue Jul 08, 2008 3:15 pm

send/recv from a thread..

Post by israr »

I can successfully create a socket and accept connection on that socket.
send/recv works fine on the new connected socket. However When I create a thread, try to call recvin that thread, recv returns an -1 , and errno is set to 0x80410005.

Code: Select all

newsock = accept(sd, &sockaddr, &addrlen);
if(newsock == -1)
{
    printf("Invalid new connection received\n");
    closesocket(sd);
    return -1;
}
printf("Accepted a new connection: %d\n",newsock);

gNewSock = newsock; //assign to a global var
//testSock(); // this function calls recv on gNewSock, and works fine.
thid = sceKernelCreateThread("childThread",  testSock, 0x11, 0xFA0, PSP_THREAD_ATTR_USER, 0);  // testSock doesnt works fine from thread..
I even tried creating thread with PSP_THREAD_ATTR_USER|PSP_THREAD_ATTR_USBWLAN flags, but that also didnt work. Do I need to somehow duplicate the socket handle in new thread?? or I can use the same handle?

I tried looking up 0x80410005 in error codes but could not find it. I am building as prx, and downloading to a 3.71 m33 via USBHostFs.
moonlight
Posts: 567
Joined: Wed Oct 26, 2005 7:46 pm

Post by moonlight »

Try to increase the stack size for the thread.
israr
Posts: 5
Joined: Tue Jul 08, 2008 3:15 pm

solved

Post by israr »

solved.. Thanks moonlight..
Post Reply