Code: Select all
s32 connection = net_socket(AF_INET, SOCK_DGRAM, IPPROTO_UDP);
if (connection < 0) GRRLIB_Printf(95, 25, tex_BMfont5, GRRLIB_LIME, 1, "could not open socket");
else GRRLIB_Printf(95,25,tex_BMfont5,GRRLIB_LIME,1,"socket opened");
Code: Select all
s32 connection = net_socket(AF_INET, SOCK_DGRAM, IPPROTO_UDP);
if (connection < 0) GRRLIB_Printf(95, 25, tex_BMfont5, GRRLIB_LIME, 1, "could not open socket");
else GRRLIB_Printf(95,25,tex_BMfont5,GRRLIB_LIME,1,"socket opened");
Code: Select all
s32 connection = net_socket (PF_INET, SOCK_DGRAM, IPPROTO_IP)
Code: Select all
s32 connection = net_socket (PF_INET, SOCK_DGRAM, IPPROTO_IP)
Code: Select all
#define AF_UNSPEC 0
#define AF_INET 2
#define PF_INET AF_INET
#define PF_UNSPEC AF_UNSPEC
Code: Select all
//---------------------------------------------------------------------------------
void *httpd (void *arg) {
//---------------------------------------------------------------------------------
s32 sock, csock;
int ret;
struct sockaddr_in server;
char temp[1026];
static int hits=0;
sock = net_socket (PF_INET, SOCK_DGRAM, IPPROTO_IP);
if (sock == INVALID_SOCKET) {
printf ("Cannot create a socket!\n");
} else {
printf("socket = %d \n", sock); // SHOWS '0'
memset (&server, 0, sizeof (server));
server.sin_family = PF_INET;
server.sin_port = htons (5555);
server.sin_addr.s_addr = inet_addr("10.0.0.145");
int n;
char buf[1024];
sprintf(buf,"wii connect :)");
//n = net_sendto(sock,buf,sizeof(buf),0,(struct sockaddr*)&server,sizeof(struct sockaddr));
n = net_send(sock,buf,sizeof(buf),0);
if (n<0) {
printf("could not connect (%d) \n", n);
} else {
printf("connected! (bytes: %d) \n",n);
}
}
return NULL;
}
Code: Select all
server.sin_len = 8; // without this set to 8? it wont work (returns -22 on send)
Code: Select all
n = net_sendto(sock,buf,sizeof(buf),0,(struct sockaddr*)&server,server.sin_len);
Users browsing this forum: No registered users and 1 guest