CodeGuru Home VC++ / MFC / C++ .NET / C# Visual Basic VB Forums Developer.com
Results 1 to 6 of 6
  1. #1
    Join Date
    Nov 1999
    Posts
    16

    WinSock - Please help

    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..


  2. #2

    Re: WinSock - Please help

    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


  3. #3
    Join Date
    Nov 1999
    Posts
    16

    Re: WinSock - Please help

    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


  4. #4
    Join Date
    Aug 1999
    Location
    US, Florida
    Posts
    817

    Re: WinSock - Please help

    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 [email protected]


  5. #5
    Join Date
    Nov 1999
    Posts
    16

    Re: WinSock - Please help

    Could you do that?

    Thanks.


  6. #6
    Join Date
    Dec 1999
    Location
    india,hyderabad
    Posts
    7

    Re: WinSock - Please help

    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

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  





Click Here to Expand Forum to Full Width

Featured