|
web
newsgroups
|
|||||||||||||||||||||||
|
|||||||||||||||||||||||
how to receive data from .NET socket into VB6 winsock ?(microsoft sample) Public Sub SendData(ByVal Data As String) ' Synclock ensure that no other threads try to use the stream at the same time. SyncLock client.GetStream Dim writer As New IO.StreamWriter(client.GetStream) writer.Write(Data & Chr(13) & Chr(10)) ' Make sure all data is sent now. writer.Flush() End SyncLock End Sub ..... ..... client.SendData(strMessage) ..... ..... # but when i receive from vb6 application # Public Sub sockMain_DataArrival(ByVal bytesTotal As Long) Dim strData As Variant MDIForm1.sockMain.GetData strData If Not IsNull(strData) Then MsgBox strData End If End Sub it returns NUMBER (numerical value) what does it mean ? how do i translate it ? how do i find an equivalent function as thi one : strMessage = Encoding.ASCII.GetString(readBuffer, 0, BytesRead - 2) thank you I suggest you try like this:
When sending: Dim writer As New IO.StreamWriter(client.GetStream, Encoding.ASCII) When receiving: Dim strData As String MDIForm1.sockMain.GetData strData, vbString cadrians***@gmail.com wrote: Show quoteHide quote > i have a socket apllication written in .NET (VB) that send data > (microsoft sample) > > Public Sub SendData(ByVal Data As String) > ' Synclock ensure that no other threads try to use the stream > at the same time. > SyncLock client.GetStream > Dim writer As New IO.StreamWriter(client.GetStream) > writer.Write(Data & Chr(13) & Chr(10)) > > ' Make sure all data is sent now. > writer.Flush() > End SyncLock > End Sub > .... > .... > client.SendData(strMessage) > .... > .... > # but when i receive from vb6 application # > > Public Sub sockMain_DataArrival(ByVal bytesTotal As Long) > > Dim strData As Variant > MDIForm1.sockMain.GetData strData > > If Not IsNull(strData) Then > MsgBox strData > End If > > End Sub > > it returns NUMBER (numerical value) > what does it mean ? > how do i translate it ? > > how do i find an equivalent function as thi one : > strMessage = Encoding.ASCII.GetString(readBuffer, 0, BytesRead - 2) > > thank you it works !
thank you very much. Truong Hong Thi wrote: Show quoteHide quote > I suggest you try like this: > When sending: > Dim writer As New IO.StreamWriter(client.GetStream, Encoding.ASCII) > > When receiving: > Dim strData As String > MDIForm1.sockMain.GetData strData, vbString > > cadrians***@gmail.com wrote: > > i have a socket apllication written in .NET (VB) that send data > > (microsoft sample) > > > > Public Sub SendData(ByVal Data As String) > > ' Synclock ensure that no other threads try to use the stream > > at the same time. > > SyncLock client.GetStream > > Dim writer As New IO.StreamWriter(client.GetStream) > > writer.Write(Data & Chr(13) & Chr(10)) > > > > ' Make sure all data is sent now. > > writer.Flush() > > End SyncLock > > End Sub > > .... > > .... > > client.SendData(strMessage) > > .... > > .... > > # but when i receive from vb6 application # > > > > Public Sub sockMain_DataArrival(ByVal bytesTotal As Long) > > > > Dim strData As Variant > > MDIForm1.sockMain.GetData strData > > > > If Not IsNull(strData) Then > > MsgBox strData > > End If > > > > End Sub > > > > it returns NUMBER (numerical value) > > what does it mean ? > > how do i translate it ? > > > > how do i find an equivalent function as thi one : > > strMessage = Encoding.ASCII.GetString(readBuffer, 0, BytesRead - 2) > > > > thank you
.NET Remoting & RTD
WebRequest.Create drawing a rectangle in a form VB.NET Progress Bar - Recursive Search DataGridView visible columns Fill in textboxes programatically in ASPX Access of shared member, constant member, enum member or nested type through an instance Two threads are accessing my Synclocked code Treeview embedded text file |
|||||||||||||||||||||||