I don't know of any online tutorials, but a book called "BSD Sockets Programming from a Multi-Language Perspective" has all the examples that you would need, in several different programming languages. The book is IPv4 only.
Alternatively, you could side-step the problem and use libCURL instead; it's included in the SDK.
Also apparently I need to connect to port 80 to use http (or smth). These are all little things that are not easy to pick up from whatever random info can be found on the web. Now i managed to connect, but calling read just blocks execution. Probably I need to use the suggestion given by Deniil to receive data.
@thread
Thanks for all the input, i will put it to the test once I get home.
80/tcp is the standard port, but it's not the only port. You might want to start with a text on TCP/IP. Like UNIX Network Programming, W. Richard Stevens's TCP/IP Illustrated, Volume 1 is the bible. Volume 1 introduces and describes TCP/IP. Volume 2 describes a complete implementation based on 4.4BSD-Lite. (Incidentally, Olaf Barthel wrote Roadshow, the IP stack in AmigaOS 4.x, using this volume as a guide.) Volume 3 describe several protocols, some common, some not so common.
Internet sockets are used by the majority of operating systems to provide access to the system's IP stack. If you want to use HTTP over TCP/IP on any mainstream system, it would be helpful to have at least a basic understanding of both IP and sockets. After that, a detailed understanding of HTTP would be more than beneficial.
If you didn't know HTTP runs over port 80 by default you need to read some basics about TCP/IP, as other suggested. :) Trial'n'error would be slow progress in this case. But a httpget.c example from the net would help.
But to get something from this http server you first need to tell it what to get using the HTTP GET command I suggested. (I might have gotten it wrong though, so verify it first if it doesn't work.) Otherwise your read() will just hang, waiting forever for the server to send you something which will never happen.
A few standard ports: 21:FTP 25:SMTP 80:HTTP 120:Telnet (??)
Software developer for Amiga OS3 and OS4. Develops for OnyxSoft and the Amiga using E and C and occasionally C++
@alfkil If you want some real help, without "please read books", you can write me mail, i will explain stuff in few phrases :) But in brief, TCP/IP its protocol, which subclasses on small ones. The classic tcp-ip4 packet structured like this:
ethernet->ip->tcp->xxxx (where xxx can be any tcp protocol, like http, pop3 and any other).
Every protocol descirbed pretty well in documents called RFC. For example, RFC793 describe TCP protcol. HTTP 1/1 protocol (which works over TCP), described in RFC2616. And all the others protocols like udp, idcmp, icmp can be found in the RFC docs as well.
So, all what you need, its just to know that TCP/IP stack its big class of small protocol, which works one over other one, which all have their structures/headers/etc, and which described in the RFC docs with all the structures and fields.
Then nextly, you need to read any normal article about non-blocked sockets (not those major books, but just some small article about non-blocked sockets). Just type in google "article about non-blocking sockets".
But, if you just want some real help, write me mail, i will send you ready-to-compile-on-amigaos sources , docs, and will explain all the stuff what need :)
PS: The best reference to "real" understanding about tcp/ip stack (and to any other network related stack) its just read articles from old-hacking diskmag (still alive) called Phrack (just because they well structured, small, and give you real information, not tons of words about nothing, like done in all that majoric books all the time).
But wouldn't you infact do "GET / HTTP 1.0\r\n" to get whatever the server provides at the root, or "GET /index.html HTTP 1.0\r\n"? Was too long ago, too lazy googling and not at home so I can check.... ;)
Software developer for Amiga OS3 and OS4. Develops for OnyxSoft and the Amiga using E and C and occasionally C++
@alfkil A library like libCURL that someone else mentioned would probably be more useful than direct access from your program. Except for simple D/L sites like Aminet or OS4Depot, the trend seems to be script links that prevent you from direct HTTP access to files. Everybody wants you to be viewing their WEB page and advertisements when accessing files or data. It seems like the days of direct HTTP downloads are numbered. When OWB was first released, I copied the links and used the old HTTPRresume program to perform the download so I could see the file size and progress. That fails so often that I don't bother anymore. Too many D/L links send you to another page that contains a scripted link that only works if your program is javascript capable.
Yes, it is, and that's the point! setsockopt() is supposed to make it send a signal once data arrives at the socket, and surely if I remove the IExec->Wait() line, I can see that data _has_ arrived at the socket, but the signal never comes. And that is only the second example, in the first one the signal actually arrives, and everything works as it is supposed to...
I'm banging my head against this, please somebody help!
EDIT: Also I can manually send a signal from Ranger, which means everything works _except_ that the signal is never emitted as it is supposed to.