I have created client and server application
i am trying to send the Arraylist from cilent to server
the Arraylist is transfer from client but how to use that Array list in server to get the information of ArrayList
while i am printing the message in server side it showing System.collection.ArrayList
below is my code
Client Code
Private Sub Button1_Click(sender As System.Object, e As System.EventArgs) Handles Button1.Click
Try
Client = New TcpClient("192.168.0.226", 8080)
Dim Writer As New StreamWriter(Client.GetStream())
detailList.Add(txtname.Text)
detailList.Add(txtadd.Text)
For Each i As String In detailList
Console.WriteLine(i)
Next
Writer.Write(detailList)
' Writer.Write("</> " & txtaddress.Text & " <\>")
MsgBox("datas send ")
Writer.Flush()
Catch ex As Exception
MsgBox(ex.Message)
End Try
End Sub
Server Code
Private Sub Timer1_Tick(sender As System.Object, e As System.EventArgs) Handles Timer1.Tick
Dim message As String
Dim nStart As Integer
Dim nLast As Integer
If listener.Pending = True Then
message = ""
cline = listener.AcceptTcpClient()
Dim reder As New StreamReader(cline.GetStream)
While reder.Peek > -1
message &= Convert.ToChar(reder.Read()).ToString
End While
If message.Contains("</>") Then
nStart = InStr(message, "</>") + 10
nLast = InStr(message, "<\>")
message = Mid(message, nStart, nLast)
End If
Console.WriteLine(message)
txtname.Text = message
Label1.Text = message
' saveData()
End If
End Sub
Public Sub saveData()
Dim cmd As SqlCommand
sc.Open()
cmd = New SqlCommand("insert into demo values('" + txtname.Text + "')", sc)
cmd.ExecuteNonQuery()
msg = MsgBox("data save")
sc.Close()
End Sub
detailList" yourArrayList, or is there an ArrayList in your detailList?