Return Styles: Pseud0ch, Terminal, Valhalla, NES, Geocities, Blue Moon.

Pages: 1-

Help with WinSock

Name: Anonymous 2010-02-03 13:48

So I'm trying to do some Windows programming. I've build a little server program which listens for a connection, receives 63 bytes and prints them. The thing is, everything works perfectly when I include winsock2.h and link to WS2_32.lib, but when I instead try to load the DLL at runtime using LoadLibrary, binding doesn't work (error code 10047: Address family not supported by protocol family.) even though the rest of the code is the same, and I've confirmed that even though I'm not including winsock2.h, the #defines have the correct values.
Any idea what might be wrong (aside programming for Windows in general)?

Name: Anonymous 2010-02-03 13:56

I haven't done any C coding in a while, but don't you need extra compile time flags for that?

Name: Anonymous 2010-02-03 13:56

winsock(sys32, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL);

Name: Anonymous 2010-02-03 14:02

>>2
For loading a library at runtime? It works OK without any flags, and the functions I get with GetProcAddress work as well.

Name: Anonymous 2010-02-03 14:34

I think I know where the problem is now. What good debuggers are there for Windows? I only heard of OllyDBG (which I'm going to try in a minute).

Name: Anonymous 2010-02-03 14:47

So I'm trying to do some Windows programming.

Now you have two problems

Name: Anonymous 2010-02-03 14:52

>>6
But did I have one in the first place?

Name: Anonymous 2010-02-03 15:19

>>5
The Visual Studio debugger?

Name: Anonymous 2010-02-03 15:48

Seems that somehow, when pushing stuff onto the stack, my data which was there was overwritten? WTF, how the heck does that happen?

Name: Anonymous 2010-02-03 16:03

>>9
Can you give an example with code?

Name: Anonymous 2010-02-03 16:04

>>6
Actually, by my count, that makes 3.

I have a problem I need help with...
I'm asking /prog/ for help
Windows programming

Name: Anonymous 2010-02-03 16:14

>>11
No, >>5 implied that I had one problem before I tried some Windows programming. Now I can have 50 or more, but that's not the point.


Also, as I thought, MSDN forgot to tell me that all the functions use WSAAPI (= __stdcall). Since the stack is managed properly now, everything works. Well, since I did try a debugger, so my time wasn't completely wasted.

Name: Anonymous 2010-02-03 16:16

>>12
s/since //
--- or ---
s/so //

Name: Anonymous 2010-02-03 16:20

dude your fucking dumb sage god dammit sage.

Name: Anonymous 2010-02-03 16:23

>>14
what about my dumb?

Name: Anonymous 2010-02-03 17:02

dumb sage
Isn't that an oxymoron?

Don't change these.
Name: Email:
Entire Thread Thread List