OSLib socket programming
Garry (87) 184 posts |
Hello, I need to wait on a socket to have to data, and act on that data ASAP. I also need to write to the same socket. I’d like to stick with the ROOL C Compiler, and OSLib, rather than move to GCC. Am I correct in thinking that eventinternet_async is the way to wait for information on a socket, without blocking? My code is coming from a platform with sound multithreading, so on there, I just ran the reading in a different thread, therefore not blocking the UI. Is there any example code showing how to do this, wait to read on a socket, without blocking? Cheers Garry |
Rick Murray (539) 13840 posts |
It has been an eternity (decade) since I last did any sockets programming… But don’t you just set the socket to non blocking? Then when you call a socket SWI and it will return a specific error (would block?) and you just keep doing that until the data arrives? Something like that… |
Rick Murray (539) 13840 posts |
Start here. Follow the “Step #” links at the bottom. |
Garry (87) 184 posts |
Hi Rick, I probably don’t have a particularly satisfactory reason why I don’t want to use UNIXLib and GCC, but then I don’t have a satisfactory reason why I’m using RISC OS at all! Any pointers/tips much appreciated. Cheers Garry |
Malcolm Hussain-Gambles (1596) 811 posts |
Hi Garry, That doesn’t use UNIXLib/GCC And the reason I use norcroft, is if I wanted to use GCC I would use linux. Cheers, Malcolm |
Chris Gransden (337) 1207 posts |
What’s GCC got to do with linux. It’s just one of many different platforms it runs on. GCC existed long before linux. |
Malcolm Hussain-Gambles (1596) 811 posts |
Running gcc on Linux is easy, tested, the libraries all work. It supports posix threading well. On most other platforms it’s an exercise in pointless pain. Many things existed before Linux but the reality is most run better and easier on Linux. |
Garry (87) 184 posts |
Hi Malcolm, Thanks again, I’ll be in touch if I require any more help. Garry |