Hi All,
I am currently sending a message to our Host (IBM mainframe), The message sending was successful as well as the reply of the Host. The problem is when the dataarrival event of my socket was triggered, the data I supposed to received were not displayed or cannot be manipulated though the 'sockedata' has values. How should I handle this? Thanks in advance
This was the sample code I made in .Net, I applied asynchronous comm.:
Public Sub Send(ByVal tmp_Data As String)
Try
Dim obj_StateObject As New StateObject
obj_StateObject.WorkSocket = m_tmpSocket
Dim BufferByte As Byte()
tmp_Data = ChrW("0") + _
ChrW("0") + _
ChrW("0") + _
ChrW(Len(tmp_Data)) + _
tmp_Data
BufferByte = AToB(tmp_Data)
m_tmpSocket.BeginSend(BufferByte, 0, _
BufferByte.Length, 0, _
New AsyncCallback(AddressOf onSendComplete), obj_StateObject)
Catch ex As Exception
End Try
End Sub
Private Sub onSendComplete(ByVal ar As IAsyncResult)
Dim obj_SocketState As StateObject = CType(ar.AsyncState, StateObject)
Dim obj_Socket As Socket = obj_SocketState.WorkSocket
Dim sck_Data As String
End Sub
Private Sub _socket_socketDataArrival(ByVal SocketID As String, ByVal SocketData As String) Handles _socket.socketDataArrival
Dim sRcvDta As String
sRcvDta = EbcAscConversion(SocketData)
textMessage.Text += sRcvDta 'SocketData & vbCrLf
End Sub