Strange socket error
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.
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
- 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
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
Winsock2.h
ws2_32.lib
________________________________pro.gram.mer - an organism that turns caffeine into code
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
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
Hi,
Are you using MSVC?
Try:
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
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
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 :)
This topic is closed to new replies.
Advertisement
Popular Topics
Advertisement
Recommended Tutorials
Advertisement