Hello all,
I am getting a very strange error in my code :( I am writing a server application in C, to send and receive UDP packets to/from a client. Right now, im just running a loop in which the server receives packets using recvfrom() however.... the function seems to block and everytime I send it something, it sets errno to "resource temporarily unavailable" which is strange, cause it blocks until I send something, meaning that it knows something came no? However, recvfrom always returns -1 This is how I initialized the socket:
//struct timeval tv;
if((s = socket(AF_INET, SOCK_DGRAM, 0))==-1)
return 0;
bzero(&si_me,sizeof(si_me));
si_me.sin_family = AF_INET;
si_me.sin_port = htons(PORT);
si_me.sin_addr.s_addr = htonl(INADDR_ANY);
/*** Set socket timeout ***
tv.tv_sec = 1;
tv.tv_usec = 0;
if (setsockopt(s, SOL_SOCKET, SO_RCVTIMEO, &tv, sizeof(tv)) < 0)
{
printf("Couldn't set socket timeoutn");
return 0;
}*/
if(bind(s,(struct sockaddr*) &si_me, sizeof(si_me))==-1)
return 0;
return 1;
and then I ran:
do
{
done = recvData();
printf("Received %d n", done);
}while(done == 0);
with recvData() being:
int recvData(void)
{
if (recvfrom(s, (char*)&buf, UDP_BUFFER_LEN, 0, (struct sockaddr*) &si_other_comp, &slen)==-1)
{
printf("Couldn't read socket (%s)n",strerror(errno));
return 0;
}
return 1;
}
so, program does nothing until it gets a packet, then says it cant read it and then continues doing nothing until it gets another packet.... any ideas?
Upload simple problem
Really confused!! I run once and it worked, but when i tried today...it didn't workWhich part is
PHP Form to Variable.
Hi! I have written a HTML-form code in DreamWeaver CS3 (in a PHP doc) and I really need it to work soon :/I have a form:(<form name="form1" action=""
Trouble checking SESSION cookie
I am trying to use $_SESSION cookies to verify admin privileges .I don't understand why this is not working:/*everything above here is working*/ $session = mysql_fetch_array($session_query); $type =
Mail sending is slow on server
Why mail is taking time to be send on apache-linux server
This must be easy , pulling the last record of the day, every day, from a txt
I have a txt file logging weather data every minutes (so 1 record per minute). I want to extract the data from the (and only that one) last record for every single day in the log file. Each record as
UDS 4.0 Datatype issue
UDS 4.0.322 -- connecting to NI Labview 9.0
SELECT * FROM users WHERE Users are not in Blocked
How do I select all users from users table where there users_id is not stored in the block table
Simple Scraper... Weird Output
Okay, maybe I just need a Blue Monster and some sleep, but.... I'm scraping a ringtone site just so that I can download all of the ringtones and add them to my personal library.The website's code that
Need help to modify php ELSE code
I'm trying to find a way to have the php code display a message if there is no inventory listed in the box, I just want it to say something like "User has no inventory listed" You can see
captcha error
I have been trying to implement a captcha in php...here is the code..Code: (php) [Select]<?php// Set the content-typeheader('Content-type: image/png');// Create the image$im =