• Post Reply Bookmark Topic Watch Topic
  • New Topic

Server Program Airplane scheduling system  RSS feed

 
jatin soneta
Greenhorn
Posts: 2
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hey Gurus.

I have a binary file

Airport Arrival Dest Arrv.
Code Name Name Time(min) (insec)
A234 DEN COS 6 45 7 17 80 0.0
U225 DEN STL 7 5 10 2 75 0.0
U256 DEN STL 13 54 16 45 50 0.0
V022 STL MCO 8 55 12 5 60 0.0
K955 STL MCO 10 54 14 10 40 0.0
K955 STL MCO 10 54 14 10 40 0.0

by the name "sched.db" and I want to create a Server program.

The whole purpose of this is Client will ask me from which Airport the flight are there. For example form "Den" how many flight are departing?
So the server should send the first three lines.

These files are in server as well in Clinet..

Gurus, I wrote the code and got stock... help me out ..please


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

class Server
{
public static void main(String args[]) throws Exception
{
String clientSentence;
String capitalizedSentence;
String nothing = " Please enter some data";
ServerSocket welcomeSocket = new ServerSocket(12003);

while(true)
{
Socket connectionSocket = welcomeSocket.accept();
BufferedReader inFromClient =
new BufferedReader (new InputStreamReader(connectionSocket.getInputStream()));

DataOutputStream outToClient =
new DataOutputStream(
connectionSocket.getOutputStream());
clientSentence = inFromClient.readLine();
if (args.length < 0)
{
outToClient.writeBytes(nothing);
}

if(args.length != 0 )
{
outToClient.writeBytes(sched.db);
}
outToClient.close();
connectionSocket.close();
welcomeSocket.close();
}
}
}
~
Where am i doing wroong.. REply me ASAp.
 
Ulf Dittmer
Rancher
Posts: 42970
73
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Welcome to JavaRanch.

So what does this code do, and what were you expecting it to do?
 
jatin soneta
Greenhorn
Posts: 2
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Right now I this code is just talking to the client..

Now my questions is

I have to find all departures from a given airport , sorted on departure on departure time, displaying at least the flight number, the destinantion and the departure time.

How do i do that... from the server side.. I have to ship all these data back to Client.

Let me know ASAP.

And again thanx for replying me
 
Ulf Dittmer
Rancher
Posts: 42970
73
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Well, you said before what the code is supposed to do. But I'm asking what it is doing. I'm guessing that there must be a disconnect between the two, or you wouldn't be asking questions.
 
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
Boost this thread!