Click to See Complete Forum and Search --> : WinSock - Please help


Ashley Winters
December 13th, 1999, 05:50 PM
Hello,

I am trying to design a simple VB which can act as both a server and client. How to go about this? I am doing WSAStartup, getting the socket. I am trying to bind or connect to the ip address but am not successful. I think there is a user error in defining the functions and variables, because the program written in the same lines in VC works fine. Please help..

czimmerman
December 14th, 1999, 04:13 PM
I recommend you approach this using the Winsock controls rather than using the Winsock API. You'll find the process much more straightforward.

Charlie Zimmerman
http://www.freevbcode.com

Ashley Winters
December 15th, 1999, 05:57 PM
I would like to do that but I am trying to put this solution into an AddIn. So I thought programming is the right way rather than using the control. What is your suggestion.

Thanks
Ash

AndyK
December 15th, 1999, 09:33 PM
You can use .bas which has almost all the functions mswinsck.ocx has..if you don't like .ocx files in your projects and modules are fine with you then email me and I'll send you the module andy_k_d@yahoo.com

Ashley Winters
December 16th, 1999, 10:17 AM
Could you do that?

Thanks.

Sudharshaan
December 28th, 1999, 05:05 AM
take 3 winsocks pal

if u want a static one use 3 winsocks with the index property set to nothing
else if u want a dynamic winsock then set index property to all the sockets to 0

here goes

winsock1.listen
***u dont have to specify a port when u make a socket listen as winsock itself generates a arbitary port***

winsock2.connect "ipaddress",remote port of the second application

WINSOCK1_CONNECTION REQUEST()
winsock3.accept requestid
winsock3.getdata strdata,vbstring

this will make a application act as a client and a server..

HINT:: TAKE INSTANT MESSENGER as a example

end sub

Sudharshaan