PSP
Code: Select all
char string[10];
sprintf(string,"PALIB_HI");
struct sockaddr_in i_addr;
i_addr.sin_family = AF_INET;
i_addr.sin_port = htons(6666);
i_addr.sin_addr.s_addr = htonl(INADDR_BROADCAST);
int i=0;
ClientSockSend=socket(AF_INET, SOCK_DGRAM, 0);
setsockopt(ClientSockSend,SOL_SOCKET,SO_BROADCAST,&optval,sizeof(char));
while(1)
{
sendto(ClientSockSend,string,10,0, (struct sockaddr *) &i_addr, sizeof(i_addr));
printf("\nSending: %d , %s",i,string);
i++;
sceDisplayWaitVblankStart();
}
Code: Select all
struct sockaddr_in i_addr;
i_addr.sin_family = AF_INET;
i_addr.sin_port = htons(6666);
i_addr.sin_addr.s_addr = htonl(INADDR_ANY);
ServerSockListen=socket(AF_INET, SOCK_DGRAM, 0);
bind(ServerSockListen, (struct sockaddr *) &i_addr, sizeof(i_addr));
int i=0;
char buffer[10];
memset(buffer,'\0',10);
while(1)
{
int size=sizeof(struct sockaddr);
int rc=0;
iprintf("Waiting: ",i,"");
int ix=0;
while(1)
{
rc=recvfrom(ServerSockListen,buffer,10,0, (struct sockaddr *) &i_addr, &size);
if(rc==-1) break;
iprintf("Buffer: ",buffer);
if(buffer[0]=='P' && buffer[1]=='A')
{
//iprintf("Received: ",buffer);
}
}
i++;
swiWaitForVBlank();
}
The PSP sends a string and the PC should receive it, but it doesn't receive anything... (Broadcast)
If I use the same code for the PC to send and the PSP to receive, it works...
Do you know why ??