Hi,
am using this code to connect to an SMS server to send sms to mobile phones, but am getting stucked at the point where i read from stream(Dim x As Integer = networkStream.Read(BR, 0, 1024)) . If anyone has any idea why am getting stucked here please inform me and if you have any resources about network streaming and such stuff please inform me. thank you in advace
Dim tcpClient As New System.Net.Sockets.TcpClient()
tcpClient.Connect("193.227.183.6", 2995)
Dim networkStream As NetworkStream = tcpClient.GetStream
If networkStream.CanRead And networkStream.CanWrite Then
Dim username As String = "talal"
Dim password As String = "ts1047"
Dim pin As String = "vqmn"
Dim senderID As String = "Eduware"
Dim str1 As String = "AUTH " & username & "," & password & "," & pin & "," & senderID & "\r\n"
Dim BA() As Byte
BA = Encoding.ASCII.GetBytes(str1)
networkStream.Write(BA, 0, BA.Length)
'Dim bufferSize As Integer = tcpClient.ReceiveBufferSize
Dim BR(2000) As Byte
[B]Dim x As Integer = networkStream.Read(BR, 0, 1024)[/B] Dim ack As String
ack = Encoding.ASCII.GetChars(BR)
If Left(ack, 4) = "ACKN" Then
Dim strS As String = "SEND 96170682451|9613332823|,0,NOW,test test\r\n"
Dim BS() As Byte
BS = Encoding.ASCII.GetBytes(strS)
networkStream.Write(BS, 0, BS.Length)
Else
Response.Write("not acknowledged")
Exit Sub
End If
Else
Response.Write("Error in connection")
Exit Sub
End If