Total members 10261 | Gratitudes |It is currently Wed May 23, 2012 7:56 am Login / Join Codemiles


All times are UTC [ DST ]




Post new topic Reply to topic  Quick reply  [ 2 posts ] 
Author Question
 Question subject: Chat with Video Transmission in Java
PostPosted: Tue Oct 26, 2010 1:32 pm 
Offline
Newbie
User avatar

Joined: Tue Oct 26, 2010 11:20 am
Posts: 1
Has thanked: 0 time
Have thanks: 0 time

Hi!

For Java classes, I wrote a simple chat (source code below). Then I added a graphical user interface (GUI) for my application (using Swing). Now I would like to add a video transmission (using a webcam). The problem is that I don't know how to start. If anyone knows a website where everything is nicely described, I'd be happy. Or can you recommend me some good book?

Code:
package app;

import java.net.*;

public class WriteServer {

  public static InetAddress host;
  public static int serverPort = 666;
  public static int clientPort = 999;
  public static int buffer_size = 1024;
  public static DatagramSocket ds;
  public static byte buffer[] = new byte[buffer_size];

  public static void main(String[] args) throws Exception {
    if (args.length == 1) {
      host = InetAddress.getByName(args[0]);
      ds = new DatagramSocket(serverPort);
      theServer();
    } else {
      ds = new DatagramSocket(clientPort);
      theClient();
    }
  }

  public static void theClient() throws Exception {
    System.out.println();
    System.out.println("============== CLIENT ==============");
    System.out.println(" HOST: " + InetAddress.getLocalHost());
    System.out.println("------------------------------------");
    System.out.println(" >>>>>>> WAIT FOR A MESSAGE <<<<<<< ");
    System.out.println("====================================");
    System.out.println();
    while (true) {
      DatagramPacket p = new DatagramPacket(buffer, buffer.length);
      ds.receive(p);
      System.out.println(new String(p.getData(), 0, p.getLength()));
    }
  }

  public static void theServer() throws Exception {
    System.out.println();
    System.out.println("============== SERVER ==============");
    System.out.println(" HOST: " + InetAddress.getLocalHost());
    System.out.println("-------------- CLIENT --------------");
    System.out.println(" HOST: " + host);
    System.out.println("------------------------------------");
    System.out.println(" >>>>>>>> TYPE YOUR MESSAGE <<<<<<< ");
    System.out.println("====================================");
    System.out.println();
    int pos = 0;
    while (true) {
      int c = System.in.read();
      switch (c) {
        case -1:
          System.out.println();
          System.out.println("========= SERVER HAS ENDED =========");
          System.out.println();
          return;
        case '\r':
          break;
        case '\n':
          ds.send(new DatagramPacket(buffer, pos, host, clientPort));
          pos = 0;
          break;
        default:
          buffer[pos++] = (byte) c;
      }
    }
  }
}

_________________
cnode


TOP
 Profile  
Reply with quote  
 Question subject: Re: Chat with Video Transmission in Java
PostPosted: Thu Oct 28, 2010 4:09 pm 
Offline
Newbie
User avatar

Joined: Thu Oct 28, 2010 4:04 pm
Posts: 2
Has thanked: 0 time
Have thanks: 0 time
hey you can solve this problem .. you need to make a media player and you need to know about the sockets. you can capture a device using java and also can transmit the captured information using sockets.... all the best lol ...


TOP
 Profile Send private message  
Reply with quote  
Post new topic Reply to topic Quick reply  [ 2 posts ] 
Quick reply


  

 Similar topics
 video chat application in java
 navigating to database using java
 java mobile apps
 need help in java
 need mini chat voice project.
 Read your gmail using Java code
 video Steganography
 Java Programing to communicating port parallel
 Java Chat
 Steganography in java

All times are UTC [ DST ]


Users browsing similar posts

Users browsing this forum: Google Adsense [Bot] and 2 guests



Jump to:  
Previous Question | Next Question 




Home
General Talks
Finished Projects
Code Library
Games
Tutorials

Java
C/C++
C-sharp
php
Script
JSP/Servlets
Ajax
ASP/ASP.net
Google SEO
Database
Communications
Phpbb3 styles
Photoshop tutorials
Flash tutorials
Find a job






Powered by phpBB © 2000, 2002, 2005, 2007 phpBB Group
All copyrights reserved to codemiles.com 2007-2011
mileX v1.0 designed by codemiles team