Closed Thread
Page 1 of 4 123 ... LastLast
Results 1 to 10 of 31

Thread: Transmitting video capture from server to client (Newbie)

  1. #1
    MrNobody is offline Newbie
    Join Date
    Oct 2006
    Posts
    23
    Rep Power
    20

    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 Attached Files

  2. CODECALL Circuit advertisement
    Join Date
    Always
    Posts
    Many

     
  3. #2
    Lop's Avatar
    Lop
    Lop is offline Speaks fluent binary
    Join Date
    May 2006
    Posts
    1,178
    Rep Power
    30
    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();
    
            }

  4. #3
    Jordan Guest
    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

  5. #4
    MrNobody is offline Newbie
    Join Date
    Oct 2006
    Posts
    23
    Rep Power
    20
    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..

  6. #5
    Lop's Avatar
    Lop
    Lop is offline Speaks fluent binary
    Join Date
    May 2006
    Posts
    1,178
    Rep Power
    30
    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

  7. #6
    MrNobody is offline Newbie
    Join Date
    Oct 2006
    Posts
    23
    Rep Power
    20
    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...

  8. #7
    Lop's Avatar
    Lop
    Lop is offline Speaks fluent binary
    Join Date
    May 2006
    Posts
    1,178
    Rep Power
    30
    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.

  9. #8
    MrNobody is offline Newbie
    Join Date
    Oct 2006
    Posts
    23
    Rep Power
    20
    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 Attached Files

  10. #9
    dirkfirst is offline Programming Expert
    Join Date
    May 2006
    Posts
    354
    Rep Power
    23
    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.

  11. #10
    MrNobody is offline Newbie
    Join Date
    Oct 2006
    Posts
    23
    Rep Power
    20
    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 Attached Files

Closed Thread
Page 1 of 4 123 ... LastLast

Thread Information

Users Browsing this Thread

There are currently 1 users browsing this thread. (0 members and 1 guests)

Similar Threads

  1. Video Capture and RAM
    By Gumbi in forum Computer Software/OS
    Replies: 1
    Last Post: 04-09-2010, 05:04 PM
  2. Help!! Video capture from webcam
    By foster82 in forum Visual Basic Programming
    Replies: 1
    Last Post: 02-06-2010, 05:19 AM
  3. Anyone have a video capture card ?
    By James.H in forum Technology Ramble
    Replies: 0
    Last Post: 01-25-2010, 12:49 PM
  4. capture video to an AVI file
    By esG in forum C Tutorials
    Replies: 2
    Last Post: 10-05-2008, 07:31 PM
  5. Video capture and transmit
    By usha_valsa in forum Java Help
    Replies: 1
    Last Post: 05-25-2008, 09:44 PM

Tags for this Thread

Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts