Sorry for the delay. I had a very rough week at the office.
I've looked into your suggestions.
- forceclosesocket();
According me that one doesn't exits.
- shutdown(my_socket, SHUT_RD)
- shutdown(my_socket, SHUT_WR)
- shutdown(my_socket, SHUT_RDWR)
None worked for me.
I started working on a solution to reuse the connection and i think i got i working. I can make dozens requests that are all accepted. I made a connection and let it sit for 45 minutes and after that time i succesfully send in another request. I now have to make sure that the the server side connection is release when the DS is shutdown but i will figure out something for that. I've got some ideas already.
This is naturally just a workaround in my case to the fact that the socket isn't closed/release and hopefully will be solved in a future release.
Dswifi works but fails after 7 attempts.
Re: Dswifi works but fails after 7 attempts.
forceclosesocket does exist but the definition may not be standard. So you would need to build your own declaration. You can see it here in the dswifi svn at line 130 http://devkitpro.svn.sourceforge.net/vi ... threv=4748. Your idea is probably better as this leaves the server connection open.
-
- Site Admin
- Posts: 1845
- Joined: Tue Aug 09, 2005 3:21 am
- Location: UK
- Contact:
Re: Dswifi works but fails after 7 attempts.
Right now a shutdown socket isn't actually released for quite some time to allow buffered data to be transmitted. This is something we added to prevent a situation where delays had to be added manually before shutting down the socket. Unfortunately this means that the DS will run out of sockets quite quickly if you're attempting to implement a web or ftp server with the current library. For now the best workaround is to keep sockets open while you're using them.
We hope to fix this situation but, as usual, time is in short supply.
We hope to fix this situation but, as usual, time is in short supply.
Re: Dswifi works but fails after 7 attempts.
ashairey, how do you force the server to close the connection?
I have the same problem as you. I'm getting info from a PHP web and saving it like this:
And then, I close the socket with:
But after 7 connections I got a socket creation error.
I've tried to wait until revc return 0 and it works, but it is VERY slow:
Could you help me?
Thanks. ^^
I have the same problem as you. I'm getting info from a PHP web and saving it like this:
Code: Select all
while(!EGL_LookForTripleChar(data, 'ö') ){ // Exit when I get my own EndOfData, ööö
memset(request_text,0,sizeof(request_text));
recvd_len = recv(my_socket, request_text, EGL_MAX_BUF, 0);
if ( recvd_len > 0 ){
request_text[recvd_len] = '\0';
strcat(data, request_text);
}
else
break;
}
Code: Select all
shutdown(my_socket, SHUT_RDWR);
closesocket(my_socket);
I've tried to wait until revc return 0 and it works, but it is VERY slow:
Code: Select all
while(1){
memset(request_text,0,sizeof(request_text));
recvd_len = recv(my_socket, request_text, EGL_MAX_BUF, 0);
if ( recvd_len > 0 ){ // Todo bien
request_text[recvd_len] = '\0';
strcat(data, request_text);
}
else
break;
}
Thanks. ^^
Who is online
Users browsing this forum: Ahrefs [Bot] and 13 guests