简体   繁体   中英

Communicate/Send Image to a VB.Net App

I am writing a VB.Net application wherein I would like to be able to communicate with it from a remote computer. Specifically, I would like to be able to send (from a remote computer) both text data and also images (jpg, png, etc.) and then have the application use the sent information by displaying it to the user. How would I code the VB.Net app to be able to handle incoming data like this?

If possible I'd like to not be dependent on .Net technology on the "sending" side so I'm not sure if I would just use sockets or a web service or what. If anybody could provide some suggestions with as much detail as possible regarding classes/methods to use, etc, I would appreciate it.

Thanks

Use a webservice of some sort maybe? Or use a database like SQL Server to store blob datatype (where you could store a file). Extract this one the other side and display it to the user.

Figured out how to do it using WebClient

Here is some sample code that makes a request to a web server for an image and displays it in an picturebox...amazingly simple:

' Downloads an image to an imagebox
Dim client As WebClient = New WebClient()

Dim thePic As Byte() = client.DownloadData("http://192.168.1.110/airplanes.jpg")

Dim stream As System.IO.MemoryStream
Dim img As Image

stream = New System.IO.MemoryStream(thePic)
img = Image.FromStream(stream)
PictureBox1.Image = img

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM