Lost Password?


Go Back   CodeCall Programming Forum > Software Development > Visual Basic Programming

Visual Basic Programming Discussion forum for Visual Basic, an event driven programming language and associated development environment from Microsoft for its COM programming model.

Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1 (permalink)  
Old 11-07-2006, 07:54 AM
MrNobody MrNobody is offline
Newbie
 
Join Date: Oct 2006
Posts: 23
Credits: 4
Rep Power: 8
MrNobody is on a distinguished road
Default Transmitting video capture from server to client (Newbie)

Hi..
Attached is a code to capture a USB webcam.
If i want to use the code as a server, what do i need to add to it..?
Preferably, sending using UDP.. can somebody please advise..

After that, I want to write a client program.. but that is later..

By the way, I am new to Visual Basic, so, help is needed and appreciated.
Thanks..
Attached Files
File Type: zip Webcam2.zip (7.6 KB, 47 views)
Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!
Reply With Quote

Sponsored Links
  #2 (permalink)  
Old 11-07-2006, 09:28 AM
Lop's Avatar   
Lop Lop is offline
Speaks fluent binary
 
Join Date: May 2006
Posts: 1,149
Credits: 119
Rep Power: 18
Lop will become famous soon enoughLop will become famous soon enough
Default

Without downloading and looking at the code... Are you using .NET or VB 6.0?

In .NET you can use the System.Net.Sockets.UdpClient

Here is the code for the TcpClient though:

Code:
private void ConnectAndSend(String ip, String Msg, int port)
        {
            // Connect to our socket
            TcpClient msgClient;


            // Try to connect
            msgClient = new TcpClient(textBox1.Text, port);

            // Create our network stream
            NetworkStream networkStream = msgClient.GetStream();
            System.IO.StreamReader streamReader = new System.IO.StreamReader(networkStream);
            System.IO.StreamWriter streamWriter = new System.IO.StreamWriter(networkStream);

            // Write our message
            try
            {
                streamWriter.WriteLine(Msg);
                streamWriter.Flush();
            }
            catch (System.Exception e)
            {
                MessageBox.Show(e.ToString());
            }

            // Disconnect
            msgClient.Close();

        }
__________________
Lop
Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!
Reply With Quote
  #3 (permalink)  
Old 11-07-2006, 08:53 PM
Jordan's Avatar   
Jordan Jordan is online now
Administrator
 
Join Date: Nov 2005
Location: Hendersonville, NC
Posts: 9,150
Last Blog:
Ext JS or Ext GWT
Credits: 1
Rep Power: 20
Jordan is just really niceJordan is just really niceJordan is just really niceJordan is just really nice
Send a message via ICQ to Jordan Send a message via AIM to Jordan Send a message via MSN to Jordan
Default

Lop, that looks like C# code instead of VB.

MrNobody, I've copied your post into the code section, I hope this is alright.

http://forum.codecall.net/tutorials-...sb-camera.html
__________________
CodeCall Blog | CodeCall Wiki | Shareware Site | Linux Forum | Write a Blog
The CodeCall Wiki is now fully integrated with vBulletin users! Check it out and add some new pages!
Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!
Reply With Quote
  #4 (permalink)  
Old 11-08-2006, 10:42 AM
MrNobody MrNobody is offline
Newbie
 
Join Date: Oct 2006
Posts: 23
Credits: 4
Rep Power: 8
MrNobody is on a distinguished road
Default

Lop:
Thanks for the reply and the code...
I am using VB 6.0. Here are a few things i need help with..

1) How do I convert the VB 6 code into VB.net..?
2) How do i change the code to make it UDP instead of TCP, because i need a fast transmission.. I don't mind loosing a few frames..
3) Can I compile the code as it is or do I need to add something else to it..?
4) How do I create a server with the webcam code added to it..?

Honestly, this is the first VB 6 program i compiled... So, sorry if i ask silly questions...


Jordan:
Sure u can put the code in the code section.. I don't mind..
Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!
Reply With Quote
  #5 (permalink)  
Old 11-08-2006, 11:40 AM
Lop's Avatar   
Lop Lop is offline
Speaks fluent binary
 
Join Date: May 2006
Posts: 1,149
Credits: 119
Rep Power: 18
Lop will become famous soon enoughLop will become famous soon enough
Default

This code is ready to be compiled and ran:

http://forum.codecall.net/tutorials-...er-client.html

Just download the attachment.

1) For converting to .NET - that is harder than said.
2) Wherever you see TcpClient use System.Net.Sockets.UdpClient or just UdpClient if you have that namespace decalred.
3) Yes, if you download the attachment
4) You will need to rewrite this in .NET if you choose to use that. I suggest you create it in .NET because I couldn't find anything on vb 6 and TCP.

Here is a tutorial:
http://www.codeproject.com/vb/net/TinyUDP.asp
__________________
Lop
Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!
Reply With Quote

Sponsored Links
  #6 (permalink)  
Old 11-08-2006, 02:07 PM
MrNobody MrNobody is offline
Newbie
 
Join Date: Oct 2006
Posts: 23
Credits: 4
Rep Power: 8
MrNobody is on a distinguished road
Default

Lop:

I went to:-
http://forum.codecall.net/tutorials-...er-client.html

But there it said:-
"This is the client, which is not in C++ but C# .NET 2.0 for"

Is C#.Net the same as VB.net..? I am very new to .Net...
Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!
Reply With Quote
  #7 (permalink)  
Old 11-08-2006, 05:15 PM
Lop's Avatar   
Lop Lop is offline
Speaks fluent binary
 
Join Date: May 2006
Posts: 1,149
Credits: 119
Rep Power: 18
Lop will become famous soon enoughLop will become famous soon enough
Default

No, C# is not the same as VB but when using the .NET language it is very easy to port. VB and C# have all of the same classes, methods, functions, and namespaces so you just need to change the way the code is called.

I don't know VB that well so I can't give an example. Sorry.
__________________
Lop
Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!
Reply With Quote
  #8 (permalink)  
Old 11-09-2006, 12:29 AM
MrNobody MrNobody is offline
Newbie
 
Join Date: Oct 2006
Posts: 23
Credits: 4
Rep Power: 8
MrNobody is on a distinguished road
Default

Hi.. I managed to find a simple client/server using UDP in VB 6.0 to send message..
Below is the code.. The code is taken from

http://homepages.ius.edu/RWISMAN/B43...ram%20Services

I just change the form caption only..
Does anybody know how I can edit both the code so that I can send Webcam Stream from server to client instead of sending messages..?
Thanks..


Lop:
I tried those C# to VB.net converter tools to convert the code but it does not work.. Maybe its because of different version of VB.net.. I am using VB Express 2005.. its ok.. thanks anyway..
Attached Files
File Type: zip UCD Client Server.zip (3.0 KB, 15 views)
Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!
Reply With Quote
  #9 (permalink)  
Old 11-11-2006, 02:25 PM
dirkfirst dirkfirst is offline
Programming Professional
 
Join Date: May 2006
Posts: 338
Credits: 3
Rep Power: 12
dirkfirst is on a distinguished road
Default

I didn't even know there was a C# to VB.net converter!

I can't see the code because I don't have VB 6. Can you post the section for sending messages? It would probably be a simple matter of adding a loop and streaming the media.
__________________
DirkFirst
Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!
Reply With Quote
  #10 (permalink)  
Old 11-12-2006, 08:06 PM
MrNobody MrNobody is offline
Newbie
 
Join Date: Oct 2006
Posts: 23
Credits: 4
Rep Power: 8
MrNobody is on a distinguished road
Default

Quote:
Originally Posted by dirkfirst View Post
I didn't even know there was a C# to VB.net converter!

I can't see the code because I don't have VB 6. Can you post the section for sending messages? It would probably be a simple matter of adding a loop and streaming the media.
Here is the website http://www.kamalpatel.net/ConvertCSharp2VB.aspx
I am not sure if it works tho...




Anyway, I have found a code for the client/server that capture and transmit webcam stream.
I have attached it below for those who are interested in doing it..

The code uses the code below to capture and send the stream

Code:
Private Sub TmrStream_Timer()
On Error Resume Next
TakeFrame
End Sub


Public Sub TakeFrame()
On Error Resume Next
Dim Bjpg As String
If Winsock1.State = sckConnected Then
SavePicture Picture1.Picture, App.Path & "\temp.bsrm"
Call ConvertBMPtoJPG(App.Path & "\temp.bsrm", App.Path & "\temp.jsrm", True, 100, False)
DoEvents
Bjpg = GetFile(App.Path & "\temp.jsrm")
DoEvents
Winsock1.SendData Bjpg
End If
End Sub
I think what it does is it uses the timer to capture a picture, convert it to JPEG and then sending it. Is this method effective..?

I came across other methods such as using DirectShow and AVICap..
Why different methods of doing similar tasks..? Which is the more effective way..?
Attached Files
File Type: zip Lan_Webcam.zip (214.0 KB, 93 views)
Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!
Reply With Quote

Sponsored Links
Reply



Currently Active Users Viewing This Thread: 1 (0 members and 1 guests)
 
Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On

Similar Threads
Thread Thread Starter Forum Replies Last Post
Access server file from client ahpooh Visual Basic Programming 1 09-06-2007 02:36 PM
Delphi Sockets : Simple client and server program tosh5457 Pascal/Delphi 0 05-26-2007 12:00 PM
Access server file from Client ahpooh Visual Basic Programming 2 02-14-2007 07:51 PM
AOL opens video search engine to developers Lop General Programming 0 09-19-2006 02:26 PM
Server side and client side Kaabi PHP Forum 6 07-30-2006 11:19 AM


All times are GMT -5. The time now is 09:57 AM.

Contest Stats

WingedPanther ........ 2662.49
Xav ........ 2581.51
Brandon W ........ 1698.26
John ........ 1207.73
marwex89 ........ 1175.24
morefood2001 ........ 959.05
dcs ........ 646.09
Steve.L ........ 475.59
orjan ........ 409.29
chili5 ........ 380.6

Contest Rules

CodeCall Goal

Goal: 100,000 Posts
Complete: 97%

Ads