Code/Resource
Windows Develop
Linux-Unix program
Internet-Socket-Network
Web Server
Browser Client
Ftp Server
Ftp Client
Browser Plugins
Proxy Server
Email Server
Email Client
WEB Mail
Firewall-Security
Telnet Server
Telnet Client
ICQ-IM-Chat
Search Engine
Sniffer Package capture
Remote Control
xml-soap-webservice
P2P
WEB(ASP,PHP,...)
TCP/IP Stack
SNMP
Grid Computing
SilverLight
DNS
Cluster Service
Network Security
Communication-Mobile
Game Program
Editor
Multimedia program
Graph program
Compiler program
Compress-Decompress algrithms
Crypt_Decrypt algrithms
Mathimatics-Numerical algorithms
MultiLanguage
Disk/Storage
Java Develop
assembly language
Applications
Other systems
Database system
Embeded-SCM Develop
FlashMX/Flex
source in ebook
Delphi VCL
OS Develop
MiddleWare
MPI
MacOS develop
LabView
ELanguage
Software/Tools
E-Books
Artical/Document
RTSPServer.java
Package: RTSPStreaming.zip [view]
Upload User: gmxazy
Upload Date: 2022-06-06
Package Size: 70k
Code Size: 2k
Category:
J2ME
Development Platform:
Java
- import java.io.*;
- import java.util.*;
- import javax.microedition.io.*;
- /**
- * Very simple RTSP server. It starts up on port 8554 and waits for incoming
- * client connections. Each connection is handled in its own thread.
- */
- public class RTSPServer implements Runnable {
- private boolean running;
- /**
- * Socket waiting for a client connection.
- */
- private ServerSocketConnection server;
- /**
- * Starts the server running.
- */
- public void start() {
- new Thread(this).start();
- try {
- while (server == null) {
- Thread.sleep(500);
- }
- } catch (Exception e) {}
- }
- /**
- * Stops the server.
- */
- public void stop() {
- running = false;
- try {
- server.close();
- } catch (Exception e) {}
- }
- /**
- * Server loop, waiting for incoming connections.
- */
- public void run() {
- running = true;
- try {
- server = (ServerSocketConnection) Connector.open("socket://:8554");
- while (running) {
- SocketConnection client = (SocketConnection) server.acceptAndOpen();
- dprint("**** Open **** n");
- new RTSPConnection(client);
- }
- } catch (Exception e) {
- e.printStackTrace();
- }
- }
- public void dprint(Object obj) {
- System.out.print(obj);
- }
- /**
- * Command line test of the server.
- */
- public static void main(String[] args) {
- new RTSPServer().start();
- }
- }