Jump to content
  • Advertisement
Sign in to follow this  
K-Zodron

Strange socket error

This topic is 4834 days old which is more than the 365 day threshold we allow for new replies. Please post a new topic.

If you intended to correct an error in the post then please contact us.

Recommended Posts

Hey, As you may notice I'm a newbie with Allegro. I'm making a client for my game(server done in a pair of days), but I have some problems with sockets, as this line doesn't really...work: if (WSAStartup(MAKEWORD(1, 1), &wsaData) != 0) I have included winalleg.h and linked libwsock32.a, if that really makes sence for you anyway. The thing that happens when that line is called the whole sh*t crashes >.> Anyone got an idea? Maybe I should post the full code, if yes, tell me.

Share this post


Link to post
Share on other sites
Advertisement
I might ask:

- Does it crash if you don't call any winsock functions?
- If so, does it crash if you don't link winsock
- If so, then the problem is definitely unrelated.

I might also ask:

Where is wsadata defined? How is wsadata defined?

What does your debugger tell you about how it crashed? Has wsadata been corrupted to an invalid pointer somehow?

Have you somehow destroyed some of the C runtime's data by a previous pointer error? If so, a crash can subsequently happen anywhere, including inside functions which should not crash.

I also might ask:

- How can you possibly have a game server if the client isn't made?
- For me, the two things have to be developed in tandem - they can't be individually tested.

Mark

Share this post


Link to post
Share on other sites
Uhm don't know much about Allegro, does it provide its own Winsock headers and libs? Are you sure you're requesting the latest Winsock version?

Winsock2.h
ws2_32.lib

Share this post


Link to post
Share on other sites
No idea where WSADATA is defined, but I use this same code for my 'DOS Prompt' test client(What I test the server with)

The debugger tells me that I crashes on that line, the backtrace just says

libwsock_a_iname
??
theLineITalkedAbout


And no it does not crash if I don't call my "startUp" function(The function only checks if there is no errors with that part and then keeps going into the next step)

Edit: Well socket.h

WSAData wsaData; <- if thats a define ;P

Share this post


Link to post
Share on other sites
Hi,

Are you using MSVC?

Try:


#include <allegro.h>
#include <winalleg.h>

//#include <winsock2.h>



I haven't used allegro in a long time, but I recall having the same problem as you have. Possibly you could ask at the allegro forums if my solution doesn't work. I'm sure that many a person has come across the same problem.

Later,

GCS584

Share this post


Link to post
Share on other sites
Quote:
Original post by gcs584
Hi,

Are you using MSVC?

Try:

*** Source Snippet Removed ***

I haven't used allegro in a long time, but I recall having the same problem as you have. Possibly you could ask at the allegro forums if my solution doesn't work. I'm sure that many a person has come across the same problem.

Later,

GCS584


I already got the header includes like that, but I'll ask on the allegro forums :)

Share this post


Link to post
Share on other sites
Sign in to follow this  

  • Advertisement
×

Important Information

By using GameDev.net, you agree to our community Guidelines, Terms of Use, and Privacy Policy.

We are the game development community.

Whether you are an indie, hobbyist, AAA developer, or just trying to learn, GameDev.net is the place for you to learn, share, and connect with the games industry. Learn more About Us or sign up!

Sign me up!