Allegro.cc - Online Community

Allegro.cc Forums » Programming Questions » ABC for Networking With Dev-C++&Allegro

This thread is locked; no one can reply to it. rss feed Print
ABC for Networking With Dev-C++&Allegro
ElPuerco
Member #2,182
April 2002
avatar

Hi, perhaps it is a dumb question, but...
I have Dev-C++, and Allegro, but
how can I do any network programming?

Is the library included? I come from
the unix world, where I just
link the net library and use
functions such as bind, open,
write, etc. How do I do it now???

Thanks!

//--------------------------------------------------------------
"Real programmers don't document. If it was hard to write, it should be hard to read."

kazzmir
Member #1,786
December 2001
avatar

You could get libnet or HawkNL. Otherwise you would have to deal with windows sockets which are evil.

X-G
Member #856
December 2000
avatar

kazzmir: Not just evil, but exceptionally evil. :P
... but I still prefer it like that. It's more hands-on, and you learn more that way.

--
Since 2008-Jun-18, democracy in Sweden is dead. | 悪霊退散!悪霊退散!怨霊、物の怪、困った時は ドーマン!セーマン!ドーマン!セーマン! 直ぐに呼びましょう陰陽師レッツゴー!

Flecko
Member #566
August 2000
avatar

Although I haven't implemented anything yet, there is Raknet. Check it out, its got a full version for non-commercial projects, and as of today, is cross platform with linux. The interface seems to be really easy as compared to doing your own sockets.

I plan on checking it out when I have some free time. I looked into libnet and HawkNL as those seem to be two that the Allegro community loves, but on the whole seem somewhat lowtech. (Sorry for not mentioning GNE Gillius, but thats above my head until you get the high level stuff finished ;D )

There are a few more nice networking libs floating around, my personal recommendation is to goto the gamedev.net networking forums and just try browsing around. Warning though, the gamedev crowd does not take kindly to stupid questions.

Good luck,
-Flecko

ben's drivel
A shark on whiskey is mighty risky, but a shark on beer is a beer engineer. This message brought to you by Old Kentucky Shark of Kentucky Nightmare Whiskey Co.

ElPuerco
Member #2,182
April 2002
avatar

???

I am still having problems with this.

1. I downloaded the precompiled
libraries, now how do I link my program
against the library?
There is a NLstatic.lib and a HawkNL.lib
should not I need a whatever.a file???

2. I downloaded the source code, tried
to make the .a library but the compiling
stops at the multithreading module.

Any help?
(Im sorry I just got back to bussiness
after a one year break)

//--------------------------------------------------------------
"Real programmers don't document. If it was hard to write, it should be hard to read."

gnolam
Member #2,030
March 2002
avatar

1. The .lib files are for MSVC, so you can't use them with MinGW/Dev-C++. You'll have to build it from the sources.

2. The problem lies with the pthread library that HawkNL uses by default for threading in Windows. Try this: delete the .o files that were created, and then add #define NL_WIN_THREADS in nl.h - this tells HawkNL to use native Windows threads instead of pthreads. Then recompile. This should work.

IIRC, there's no "make install" option, so you'll have to copy the relevant libraries and header files to the proper directories yourself.

[EDIT]
Weird. Now I can't get it to work. Anyway, since I still have libNL.a and NL.dll from before I lost my mojo, I uploaded them to my university account:
hawkcomp.zip [44 kB]

[EDIT 2]
It seems you can get it to compile - by manually removing -lpthreadsGC from the makefile.

--
Move to the Democratic People's Republic of Vivendi Universal (formerly known as Sweden) - officially democracy- and privacy-free since 2008-06-18!

Sakuera
Member #3,222
February 2003
avatar

Does MinGW have network libraries? If so, could you give me links to some networking tutorials?

Thomas Fjellstrom
Member #476
June 2000
avatar

Evil? Isn't WinSock a close clone of BSD Sockets? I used them to make an HTTP server. They are quite easy to use...

--
Thomas Fjellstrom - [website] - [email] - [Allegro Wiki] - [Allegro TODO]
"If you can't think of a better solution, don't try to make a better solution." -- weapon_S
"The less evidence we have for what we believe is certain, the more violently we defend beliefs against those who don't agree" -- https://twitter.com/neiltyson/status/592870205409353730

Sakuera
Member #3,222
February 2003
avatar

ARRGHH I'm currently on microsoft.com and have found the freakin networking refference, but how can I download this all, not just view pages that describe one function each.

????????????

Thomas Fjellstrom
Member #476
June 2000
avatar

use the forum search, I found a thread that linked to several good resources for WinSock.

--
Thomas Fjellstrom - [website] - [email] - [Allegro Wiki] - [Allegro TODO]
"If you can't think of a better solution, don't try to make a better solution." -- weapon_S
"The less evidence we have for what we believe is certain, the more violently we defend beliefs against those who don't agree" -- https://twitter.com/neiltyson/status/592870205409353730

ElPuerco
Member #2,182
April 2002
avatar

// Nevermind, I fix the problem
//duh

//--------------------------------------------------------------
"Real programmers don't document. If it was hard to write, it should be hard to read."

Johan Henriksson
Member #11
April 2000
avatar

with the exception of doing ipv6 (takes special code) and doing asynchronous DNS lookups (get the lib adns for that) I think winsock and bsdsock are the best ways to do networking. the only exception is when you just want to throw some crap together. which I hope you aren't :)

as for hawkNL or any similar lib, I consider it close to crap. while it indeed brings you closer to the code you want, it adds another library dependance and 99% of it is just renamed commands.

the alternative (for those crap programs) is to move out all the stuff that makes sockets hard into "big" commands. but that will make you lose so much speed MS word will have higher FPS.

the best way is to make your own abstraction layer that suits your game the best - but then you will prefer to get your hands dirty because of the extra control it gives.

edit: and to really answer the first question:
winsock is the traditional bsd sock. only, you have to call a function at start and the #includes are different. so a simple #ifdef WIN32 will give you portability windows<->any other OS.

X-G
Member #856
December 2000
avatar

,ahpgny: Go see my link at the top of this thread and try to solve my problem. Good luck to you. :P

--
Since 2008-Jun-18, democracy in Sweden is dead. | 悪霊退散!悪霊退散!怨霊、物の怪、困った時は ドーマン!セーマン!ドーマン!セーマン! 直ぐに呼びましょう陰陽師レッツゴー!

Johan Henriksson
Member #11
April 2000
avatar

you forget I do C, not C++ :) that code surely does not look like ordinary sockets :o

Edit: but I have some well encapsulated code you can borrow that does what you want; just look me up on IRC if interested.

X-G
Member #856
December 2000
avatar

The class encapsulates ordinary BSD sockets. Go and actually READ them, why don't you?

--
Since 2008-Jun-18, democracy in Sweden is dead. | 悪霊退散!悪霊退散!怨霊、物の怪、困った時は ドーマン!セーマン!ドーマン!セーマン! 直ぐに呼びましょう陰陽師レッツゴー!

Johan Henriksson
Member #11
April 2000
avatar

I'm dumb!. it had so much other "crap" with threads and stuff I started wondering what you were up to :)

Go to: