Quantcast
Channel: VBForums - Visual Basic .NET
Viewing all articles
Browse latest Browse all 27371

Problem With Function to Return Array

$
0
0
I have a small project doing some P2P communication between a client and a server. The data stream comes in to the server, gets parsed and processed, then a I want to send the results of that back to the client. I'm using a function to do this which I want to return the results which then get passed back to the client. It kind of works but what shows back up at the client is "System.Object" and not the literal string that I was looking for.

Code:

Sub Reply2Client(ByVal Message As Object)
    Client - New TcpClient("192.168.0.1"), 65535)
    Dim Writer As New StreamWriter(Client.GetStream())
    Writer.Write(ParseData(Message))
    Writer.Flush()
End Sub

Function ParseData(ByVal vStream As Object)
    Dim vWord(15)
    Dim count As Integer

    Dim words As Object() = vStream.Split("&")
    Dim word as Object

    For Each word In words
          vWord(count) = Mid(word, Instr(word, "=") +1)
          count = count + 1
    Next

    Return vWord
End Function

I've checked that the parsing is being done right and it is. But when this gets sent back to the client it appears as System.Object. I have tried this:

Code:

    Return vWord(0) & vWord(1) & vWord(2)
and that appears on the client side as it should. So I think I'm close here I just want to send the entire array vWord() back to the client.

Viewing all articles
Browse latest Browse all 27371

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>