Hi, i can't figure out how i could get the program to make/send the screenshot to the server, or atleast save it to a folder, when the server has requested it via a button.
I know there are many ways to get the screenshot, but mainly the problem is that i don't know how to send the request to the client from the server.
This is the client code to establish a connection to the Lan Server:
Code for the Server:
Thank you.
I know there are many ways to get the screenshot, but mainly the problem is that i don't know how to send the request to the client from the server.
This is the client code to establish a connection to the Lan Server:
Code:
Try
Dim client As TcpClient
client = New TcpClient("192.168.0.12", 8000)
Dim writer As New StreamWriter(client.GetStream())
writer.Write(RichTextBox1.Text)
writer.Flush()
Catch ex As Exception
End Try
End Sub
Code:
Public Class Form1
Dim Listener As New TcpListener(8000)
Dim Client As TcpClient
Private Sub Form1_FormClosing(ByVal sender As Object, ByVal e As System.Windows.Forms.FormClosingEventArgs) Handles Me.FormClosing
Listener.Stop()
End Sub
Private Sub Form1_Load(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles MyBase.Load
Timer1.Start()
Listener.Start()
End Sub
Private Sub Timer1_Tick(ByVal sender As Object, ByVal 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 = ""
Client = Listener.AcceptTcpClient()
Dim reader As New StreamReader(Client.GetStream())
While reader.Peek > -1
message &= Convert.ToChar(reader.Read()).ToString
End While
If message.Contains("</>") Then
nStart = InStr(message, "</>") + 4
nLast = InStr(message, "<\>")
message = Mid(message, nStart, nLast - nStart)
End If
RichTextBox1.Text = message
End If
End Sub
End Class