News:

MASM32 SDK Description, downloads and other helpful links
MASM32.com New Forum Link
masmforum WebSite

Are there different libs for Winsock 1.1 and 2?

Started by asit, May 19, 2012, 08:24:13 AM

Previous topic - Next topic

asit

Hi,

I have been into Win32 C programming for some time, shifted to it from gtk when I started using windoze more. Honestly it sucked compared to gtk+  :red but I really wanted to learn. Then I found MASM32 and started trying Winsock in it that was pretty much similar to functions in linux.

Now the problem.

I tried to implement my C tutorial on winsock to masm, that was using winsock 2. The Iczelion (pardon spelling if wrong) tutorial seemed to give a wider perspective but does not show whether to include ws2_32.inc or wsock32.inc  ::) actually it doesnt show includes at all!

Now the question is pretty much simple to ask: If I need to mention ONLY Winsock 1.1 in WSAStartup and use 1.1 in rest of the program, should I include ws2_32.inc or wsock32.inc? I don't think I need to give code samples for it since it's a question of syntax.

Thanks in advance for your expert comments and answers!  :toothy
Please like this Facebook page
ONLY FOR MASM32 PROGRAMMERS!

MASM32 Programming
https://www.facebook.com/masm32

dedndave

        include    \masm32\include\ws2_32.inc
        includelib \masm32\lib\ws2_32.lib


it doesn't appear that the masm32 package even has the old one   :P

jj2007

WSAStartup PROTO STDCALL :DWORD,:DWORD
Found in \masm32\include\wsock32.inc

It's one of the few that are NOT included in \masm32\include\masm32rt.inc, but this is sufficient to start coding:

.nolist  ; save 80ms assembly time and 4MB of disk space ;-)
include \masm32\include\masm32rt.inc
uselib wsock32

.code
start: MsgBox 0, hex$(WSAStartup), "Address of WSAStartup:", MB_OK
exit
end start

asit

Quote from: dedndave on May 19, 2012, 08:37:11 AM
        include    \masm32\include\ws2_32.inc
        includelib \masm32\lib\ws2_32.lib


it doesn't appear that the masm32 package even has the old one   :P

It has! Here's it attached.. (from the C:\masm32\include folder)

The problem is that they both have functions mixed up.. I guess I'll prefer using winsock 1.1 to be compatible with windoze derps older than NT  :'( that's the cost you pay for compatibility
Please like this Facebook page
ONLY FOR MASM32 PROGRAMMERS!

MASM32 Programming
https://www.facebook.com/masm32

asit

Quote from: jj2007 on May 19, 2012, 08:57:19 AM
WSAStartup PROTO STDCALL :DWORD,:DWORD
Found in \masm32\include\wsock32.inc

It's one of the few that are NOT included in \masm32\include\masm32rt.inc, but this is sufficient to start coding:

.nolist
include \masm32\include\masm32rt.inc
uselib wsock32

.code
start: MsgBox 0, hex$(WSAStartup), "Address of WSAStartup:", MB_OK
exit
end start


hey thanks jj2007! that speaks for it then. btw i found a good example just now. it's an old network program called sparcz.asm (attached). it uses wsock32.inc and wsock32.lib. it uses 0101h (winsock 1.1) with WSAStratup. it works.. so it should be correct. i'll try wsock32.inc then. i hope it's the right one.

i'll reply back if it works. thanks a lot guys! :)
Please like this Facebook page
ONLY FOR MASM32 PROGRAMMERS!

MASM32 Programming
https://www.facebook.com/masm32

dedndave

ah yes - the old one is in there - my bad
i was looking through the list alphabetically - and saw nothing starting with "winso"

asit

@dedndave Right that happened to me too some time back. ofcourse it's obvious to name it winsock32 instead of wsock32 (like the C header winsock2.h). But no probs.

Btw I have found the answer. The wsock32.inc works perfectly. I made a tiny "web server" using it  :toothy lol i'll stop embarassing myself calling it web server now! heh
Thanks a lot guys for helping me out here!

I can successfully use these functions with wsock32.inc and wsock32.lib pair (in case anybody wants to know) :
WSAStartup, socket, connect, send and recv.

Have a nice long weekend. cheers!  :U

(Whoever mods here. You may plz close this topic. It's solved I am sure)
Please like this Facebook page
ONLY FOR MASM32 PROGRAMMERS!

MASM32 Programming
https://www.facebook.com/masm32