[ Close ]
Username
Password


Forgotten your password?
 
Custom Search
Computer/IT Projects
 Projects Q A, Guidance for your projects » Projects Forum » Computer/IT Projects
Message Icon Topic: sending image to server Post Reply Post New Topic
Found this useful? Give a +1   Add to Facebook: Add to Facebook
Free Project Downloads
CS / IT Project Downloads
.Net Project Downloads
JAVA Project Downloads
PHP Project Downloads
Networking Proj Downloads
Project Topics
Computer(CS/IT) Projects
Software Mini Project Topics
Android Project Topics
Networking Project Ideas
Dot Net Project Topics
Latest IEEE Projects List
IEEE JAVA Project Topics
Project Presentation Tips
How to choose Project Topic
Tips for Final Year Project
Steps for FYP, Mini Project
Preparing a Project Report
Problems faced in Projects
 
Get Free Software CS / IT Project Downloads:

Enter your email address:  

Author Message
nishutank
Newbie
Newbie


Joined: 15-Jun-2011
Online Status: Offline
Posts: 0
Quote nishutank Replybullet Topic: sending image to server
    Posted: 18-Feb-2012 at 8:51pm
i want vb.net code in which:
client is taking the screenshot of its own computer and sending this image to server....and on the server side,there is a picture box which will display the received image....please provide me some code or help..

 
IP IP Logged
LokeshNash
Newbie
Newbie


Joined: 21-Sep-2008
Online Status: Offline
Posts: 4
Quote LokeshNash Replybullet Posted: 21-Feb-2012 at 8:44pm
A sample...

Image Streaming from server to client:

Server:

01          Private Sub button1_Click(sender As Object, e As EventArgs)
02         button1.Enabled = False
03      
04         Dim socketThread As Thread
05         socketThread = New Thread(New ThreadStart(AddressOf ScreenShot))
06         socketThread.Start()
07     End Sub
08      
09     ''' <summary>
10     ''' Sends a screenshot to a client
11     ''' </summary>
12     Private Sub ScreenShot()
13      
14         Dim screenWidth As Integer = 240
15         Dim screenHeight As Integer = 320
16      
17         Dim listener As New TcpListener(IPAddress.Any, 5000)
18         listener.Start()
19         While True
20      
21             Dim tc As TcpClient = listener.AcceptTcpClient()
22             Dim ns As NetworkStream = tc.GetStream()
23             Dim btfromc As Byte() = New Byte(99) {}
24             Dim img As New Bitmap(screenWidth, screenHeight)
25             Using gfx As Graphics = Graphics.FromImage(img)
26                 gfx.CopyFromScreen(0, 0, 0, 0, New Size(screenWidth, screenHeight))
27             End Using
28      
29             Dim s As New MemoryStream()
30      
31             img.Save(s, System.Drawing.Imaging.ImageFormat.Png)
32      
33             Dim btback As Byte() = s.ToArray()
34      
35             ns.Write(btback, 0, btback.Length)
36             ns.Close()
37             tc.Close()
38         End While
39     End Sub


Client:

Private Sub button1_Click(sender As Object, e As EventArgs)
02         t.Interval = 30
03         t.Enabled = True
04         t.Tick += New EventHandler(AddressOf t_Tick)
05      
06         button1.Enabled = False
07         'ns = server.GetStream();
08     End Sub
09      
10     Private Sub t_Tick(sender As Object, e As EventArgs)
11      
12      
13         Dim client As New TcpClient("192.168.1.7", 5000)
14         Dim ns As NetworkStream = client.GetStream()
15         Dim imgSize As Byte() = New Byte(1023) {}
16         Dim gotCount As Integer = 0
17         Dim picsize As Integer = 0
18         Using ms As New MemoryStream()
19             While True
20                 Try
21                     gotCount = ns.Read(imgSize, 0, imgSize.Length)
22                     ms.Write(imgSize, 0, gotCount)
23                     picsize += gotCount
24                     If gotCount = 0 Then
25                         Exit Try
26                     End If
27                 Catch e1 As Exception
28                     Dim s As String = e1.Message
29                     s = e1.StackTrace
30                 End Try
31             End While
32      
33             Dim res As New Bitmap(ms)
34             pictureBox1.Image = res
35             pictureBox1.Invalidate()
36             ns.Close()
37             client.Close()
38         End Using
39      
40     End Sub

 
IP IP Logged
nishutank
Newbie
Newbie


Joined: 15-Jun-2011
Online Status: Offline
Posts: 0
Quote nishutank Replybullet Posted: 22-Feb-2012 at 8:06pm
thank u for the help...
but what is 't' in client code...u need to declare that 't'...line no.2,3,4...
IP IP Logged
nishutank
Newbie
Newbie


Joined: 15-Jun-2011
Online Status: Offline
Posts: 0
Quote nishutank Replybullet Posted: 22-Feb-2012 at 8:53pm
and program is not working properly..there is some problem...client is not responding..its not showing the screenshot..
IP IP Logged

 
Post Reply Post New Topic

Free Programming Courses in JAVA, .Net and PHP (Register Now!)

Java Free Online Course

.Net Free Online Course

PHP Free Online Course


 
Printable version Printable version

Forum Jump
You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot delete your posts in this forum
You cannot edit your posts in this forum
You cannot create polls in this forum
You cannot vote in polls in this forum



This page was generated in 0.031 seconds.
© ProjectsQA.com   |   Privacy policy