I'm having issues using code I obtained from another source.
The Client side sending...
The server side receiving
I have been able to get the server side to get some of the images sometimes but never has it gotten to display on the imagebox.
I had to take inImage.Save to get the image.
I get a serialization error
Please do not bash or be rude. I would like help not immaturity. Thank you.
The Client side sending...
Code
Private Sub startListening()
Try
listener = New TcpListener(Port)
listener.Start()
mainSocket = listener.AcceptSocket()
s = New NetworkStream(mainSocket)
eventWatcher = New Thread(New ThreadStart(AddressOf waitForKeys))
eventWatcher.Start()
While True
Dim screeny As New Bitmap(Screen.PrimaryScreen.Bounds.Width, Screen.PrimaryScreen.Bounds.Height, PixelFormat.Format32bppArgb)
Dim bFormat As New BinaryFormatter()
bFormat.Serialize(s, screeny)
screeny.Save(s, ImageFormat.Png)
screeny.Save("image.bmp")
Thread.Sleep(imageDelay)
screeny.Dispose()
End While
Catch generatedExceptionName As Exception
If mainSocket.IsBound Then
mainSocket.Close()
End If
If listener IsNot Nothing Then
listener.[Stop]()
'MessageBox.Show(gay.ToString());
End If
End Try
End SubThe server side receiving
Code
Private Sub startRead()
Try
stream = client.GetStream()
eventSender = New StreamWriter(stream)
While True
Dim bFormat As New BinaryFormatter()
Dim inImage As Bitmap = bFormat.Deserialize(stream)
resolutionX = inImage.Width
resolutionY = inImage.Height
theImage.Image = inImage
theImage.BackgroundImage = inImage
End While
Catch ex As Exception
Debug.WriteLine("Error " + ex.Message)
End Try
End SubI have been able to get the server side to get some of the images sometimes but never has it gotten to display on the imagebox.
I had to take inImage.Save to get the image.
I get a serialization error
Quote:Exception thrown: 'System.Runtime.Serialization.SerializationException' in mscorlib.dll
Error The input stream is not a valid binary format. The starting contents (in bytes) are: 89-50-4E-47-0D-0A-1A-0A-00-00-00-0D-49-48-44-52-00 ...
Please do not bash or be rude. I would like help not immaturity. Thank you.

