Logo 
Search:

Java Articles

Submit Article
Home » Articles » Java » CorbaRSS Feeds

Corba program of UDP client server application which sends the news to the client. Server takes the news from the NewsDataFile located at the server

Posted By: Milind Mishra     Category: Java     Views: 2410

Corba program of UDP client server application which sends the news to the client.
Server take the news from the NewsDataFile located at the server.

Code for Corba program of UDP client server application which sends the news to the client. Server takes the news from the NewsDataFile located at the server in Java

// Server

import java.io.*;
import java.net.*;

publicclass news_server
{
 publicstaticvoid main(String[] args) throws IOException 
 {
  int ch1;
  String str;
    FileReader fr = new FileReader("news.txt");
    BufferedReader br = new BufferedReader(fr);
 

  Socket C = new Socket("localhost",4000);
  OutputStream out = C.getOutputStream();

  DataOutputStream Dos = new DataOutputStream(out);

  
  while( (str = br.readLine()) != null)
  {
         Dos.writeUTF("Latest News (From Server ) :: " + str);
  }
  Dos.flush();
  fr.close();
 }
}


// Client//                               Client //               =====    


import java.io.*;
import java.net.*;
import java.util.*;

publicclass news_client
{
 publicstaticvoid main(String[] args) throws IOException 
 {
  ServerSocket S = new ServerSocket(4000);
  Socket Client = S.accept();
  InputStream in = Client.getInputStream();
  DataInputStream Dis = new DataInputStream(in);
  System.out.println(Dis.readUTF());
  Client.close();
 }
}


// OUTPUT
    
News.txt
=========================
India won the Worldcup by beating
Australia by 6 wkt.
===========================


//  Server
C:\jdk1.1.3\bin>javac news_server.java

C:\jdk1.1.3\bin>java news_server


//  Client
C:\jdk1.1.3\bin>java news_client
Latest News (From Server ) :: India won the Worldcup by beating
Australia by 6 wkt.


  
Share: 



Milind Mishra
Milind Mishra author of Corba program of UDP client server application which sends the news to the client. Server takes the news from the NewsDataFile located at the server is from India.
 
View All Articles

Related Articles and Code:


 
Please enter your Comment

  • Comment should be atleast 30 Characters.
  • Please put code inside [Code] your code [/Code].

 
No Comment Found, Be the First to post comment!