AnsweredAssumed Answered

TCP recieve function

Question asked by Camilo A Camacho D on Jan 21, 2013
Latest reply on Jan 21, 2013 by Camilo A Camacho D

Hi everybody good afternoon, I have a problem with the recv() function in a TCP/IP application. I need a task that hears all the time if somethig is recieved, so I put this function into an infinite loop, no problem with that. The thing is that I need to continue with my program if nothing is recieved after a period of time, let`s say 1 second for this example. I`ve tried everything and the only way to break out this loop is if I recieve something in my buffer. I`ve tried with all the posible flags (the last argument of the recv function) and nothing works. Furthermore, I have understood that this flags works with UDP sockets an mine is a TCP socket. I thought that a good solution was to create another task that oversees the task where I have my infinite loop, so one task is always listening and the other looking at the data recieved in the buffer. The thing is that in this second new task, once I get to the send() function the program gets lost, it appears to be a pointer, but I don´t know why, It seems that I can only use the send and recieve functions in the main task where I declare the socket and all the connection parameters, Anyone have some info to share with me regarding this issue? Thank you in advanced for your cooperation.