forums.ps2dev.org Forum Index forums.ps2dev.org
Homebrew PS2, PSP & PS3 Development Discussions
 
 FAQFAQ   SearchSearch   MemberlistMemberlist   UsergroupsUsergroups   RegisterRegister 
 ProfileProfile   Log in to check your private messagesLog in to check your private messages   Log inLog in 

send/recv from a thread..

 
Post new topic   Reply to topic    forums.ps2dev.org Forum Index -> PSP Development
View previous topic :: View next topic  
Author Message
israr



Joined: 08 Jul 2008
Posts: 5

PostPosted: Tue Jul 08, 2008 3:36 pm    Post subject: send/recv from a thread.. Reply with quote

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:

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.
Back to top
View user's profile Send private message
moonlight



Joined: 26 Oct 2005
Posts: 567

PostPosted: Tue Jul 08, 2008 4:02 pm    Post subject: Reply with quote

Try to increase the stack size for the thread.
Back to top
View user's profile Send private message
israr



Joined: 08 Jul 2008
Posts: 5

PostPosted: Tue Jul 08, 2008 4:07 pm    Post subject: solved Reply with quote

solved.. Thanks moonlight..
Back to top
View user's profile Send private message
Display posts from previous:   
Post new topic   Reply to topic    forums.ps2dev.org Forum Index -> PSP Development All times are GMT + 10 Hours
Page 1 of 1

 
Jump to:  
You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot vote in polls in this forum


Powered by phpBB © 2001, 2005 phpBB Group