My problem is that I am not receiving all of the data that I should be. I am only receiving 7 records rather then receiving 12. Is there a time limit that a socket can recieve for? Is there something else that could be my problem that I would not be receiving all of the information that the server is definitly sending me?

My receive code

Dim cpBytesRec As Int64 = sender2.Receive(bytes)
dataFromCp = Encoding.ASCII.GetString(bytes, 0, cpBytesRec)
Console.WriteLine("Data From ChoicePoint = {0}", dataFromCp)

All of the code

Private Function TransmitToCP(ByVal data As Byte()) As String

        Dim cpPort As Integer = 10102                       
        Dim bytes(1500) As Byte
        Dim dataFromCp As String = ""
        Dim CPDATA As String = ""
        Dim longip As IPAddress
        longip = IPAddress.Parse("67.241.41.236")


        Try
            Dim cpServerEP As New IPEndPoint(longIP, cpPort)

            ' Create a TCP/IP socket.
            Dim sender2 As New Socket(AddressFamily.InterNetwork, _
                SocketType.Stream, ProtocolType.Tcp)

            Console.WriteLine("Socket waiting to connect to cp")

            ' Connect the socket to the remote endpoint. Catch any errors.
            Try
                sender2.Connect(cpServerEP)

                Console.WriteLine("Socket connected to cp {0}", _
                    sender2.RemoteEndPoint.ToString())


                ' Send the data through the socket.
                Dim bytesSent As Integer = sender2.Send(data)



                ' Receive the response from the remote device.
                Dim cpBytesRec As Int64 = sender2.Receive(bytes)
                dataFromCp = Encoding.ASCII.GetString(bytes, 0, cpBytesRec)
                Console.WriteLine("Data From ChoicePoint = {0}", dataFromCp)


                ' Release the socket.
                sender2.Shutdown(SocketShutdown.Both)
                sender2.Close()
Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.