Sign in to follow this  
DMINATOR

internet and C

Recommended Posts

I am thinking about starting to program applications that use internet. Does anyone know what whould be better to use ? I won't to program it in C or C++ , and be able to port it to other OS. Thank's in advance.

Share this post


Link to post
Share on other sites
You should use winsock, it doesnt matter if you use c or c++.

Winsock is a socket api for windows, you should learn it because the linux socket library is very similar.

http://tangentsoft.net/wskfaq/

Theres a faq for you.

Share this post


Link to post
Share on other sites
Thank's for replyes it doesn't matter for me how hard it is to learn , I have free time for now, i think il stick with winsock.

hmm GWBasic ? - was once the main language used on home computers and is still useful in learning the fundamentals of computer programming and smaller utility programs. It still runs on Microsoft Windows computers thru WindowsXP, though not in a window, but on the black screen used for MS-DOS programming above that will pop up when you click on the GWBASIC icon. <http://www.geocities.com/KindlyRat/GWBASIC.html>

WinINet - maybe i Learn it later.

SDL_net - is interesting API, I haven't found how does it use net though.

Share this post


Link to post
Share on other sites
If you want to port it, I recommend SDL_net, it's cross-platform, so you don't even need to change any code.

Quote:
Original post by DMINATOR
SDL_net - is interesting API, I haven't found how does it use net though.


uh, what's that supposed to mean?

Share this post


Link to post
Share on other sites
Quote:
Original post by Roboguy
If you want to port it, I recommend SDL_net, it's cross-platform, so you don't even need to change any code.

Quote:
Original post by DMINATOR
SDL_net - is interesting API, I haven't found how does it use net though.


uh, what's that supposed to mean?


Hmm i wan't to add my application with internet support but as I look in this link I didn't find any of this.

Share this post


Link to post
Share on other sites
That's SDL, not SDL_net, SDL_net is an extension library for SDL, here is the SDL_net documentation, and here is the download page(note: you will need SDL in addition to SDL_net), and, finally the online API reference, is here

Share this post


Link to post
Share on other sites
Guest Anonymous Poster
Quote:
Original post by DMINATOR
I am thinking about starting to program applications that use internet. Does anyone know what whould be better to use ? I won't to program it in C or C++ , and be able to port it to other OS. Thank's in advance.


I've been working on a MMORPG in C.
My interent code is actually from a Linux Winsock tutorial. It should compile quite smoothly on Linux, with little to no changes to the code (Except those Microsoft specific pragma's [bawling]).

Share this post


Link to post
Share on other sites
Quote:
Original post by Anonymous Poster
Quote:
Original post by DMINATOR
I am thinking about starting to program applications that use internet. Does anyone know what whould be better to use ? I won't to program it in C or C++ , and be able to port it to other OS. Thank's in advance.


I've been working on a MMORPG in C.
My interent code is actually from a Linux Winsock tutorial. It should compile quite smoothly on Linux, with little to no changes to the code (Except those Microsoft specific pragma's [bawling]).


I think most compilers(including gcc) ignore all unknown pragma's, so you should be ok

Share this post


Link to post
Share on other sites
Quote:
Original post by DMINATOR
Thank's for replyes it doesn't matter for me how hard it is to learn , I have free time for now, i think il stick with winsock.


let us all know if you suceed, I guess you would probably want to use asynchronous sockets, as they work the message procedure nicely.

I've already tried and failed, so I would be very interested if you got something working to show me :)

my email's andrewhh@msn.com if u can be bothered writing that down :)

thx

Share this post


Link to post
Share on other sites
Quote:
Original post by johnnyBravo
let us all know if you suceed, I guess you would probably want to use asynchronous sockets, as they work the message procedure nicely.
Asyc sockets are windows only. The only real portable method without using external libs like SDL (Using SDL means needing an additional 2 DLLs which looks ugly (IMO)) is to use "normal" sockets, and poll them with select().
I ported my socket code from Windows to Linux (Redhat 8) and it was extremely simple. One thing to look out for is that the first argument to select() is ignored in Windows, but used in Linux.

I also find blocking sockets far easier to deal with because you can just check if the socket is ready then send/recv instead of having to deal with notifications in the message procedure. Think of it a little like multithreaded vs singlethreaded.

Share this post


Link to post
Share on other sites
Heh i am going to try first something simple that works, cause all the examples i tryed failed to connect either to localhost or specified server :)

Share this post


Link to post
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now

Sign in to follow this