Forum Discussion

reshma_bh's avatar
reshma_bh
New Contributor
11 years ago

VB Script for connecting to server using TCP/IP protocol

I am new to automation and trying to identify the right tool for our product.



Can anybody send me the VB Script for connecting to server using TCP/IP protocol or guid em ein the direction where i can get some info on.

2 Replies

  • TanyaYatskovska's avatar
    TanyaYatskovska
    SmartBear Alumni (Retired)

    Hi Reshma,


     


    I've found a similar thread of yours here. Let's continue the discussion there.

  • Hi Tanya,



    I am having some trouble with the TCP/IP server code published on your website. if I use a random port, It fails on socket.bind. the error says :

    Invalid procedure call or argument.



    But if I use an already listning port, then it freezes on socket.Accept()

    Any suggestions????



    address = "127.0.0.1";

        port = 3751;

        receiveTimeout = 15000;

        connectionsQueueLength = 2;

     

        socket = dotNET.System_Net_Sockets.Socket.zctor(

            dotNET.System_Net_Sockets.AddressFamily.InterNetwork,

            dotNET.System_Net_Sockets.SocketType.Stream,

            dotNET.System_Net_Sockets.ProtocolType.Tcp

        );

            

        broadcast = dotNET.System_Net.IPAddress.Parse(address);

        

        endpoint = dotNET.System_Net.IPEndPoint.zctor_2(broadcast, port);

            

        socket.Bind(endpoint);

        socket.Listen(connectionsQueueLength);

     

        connectedSocket = socket.Accept();

        connectedSocket.SetSocketOption_3(

            dotNET.System_Net_Sockets.SocketOptionLevel.Socket,

            dotNET.System_Net_Sockets.SocketOptionName.ReceiveTimeout,

            receiveTimeout);

    ..................



    Is there anything that I'm doing wrong?