Echo Server Program

Apr 20, 2015

I was writing the code for a Echo server program.Below is the client part. I am having an issue in it. When I write something between the String InputLine, and the while method, I get the echo message but if I remove that line(bold), I didn't get any reply.

import java.io.BufferedReader;
import java.io.IOException;
import java.io.InputStreamReader;
import java.io.PrintWriter;
import java.net.Socket;
import java.net.UnknownHostException;

[code]....

View Replies


ADVERTISEMENT

Swing/AWT/SWT :: Unwanted Echo Of JTextField

Oct 29, 2014

I recently began writing a much larger program than I will show. I have boiled the problem down to this SSCCE.

import javax.swing.JFrame;
import javax.swing.JPanel;
import javax.swing.JRadioButton;
import javax.swing.JTextField;
import javax.swing.SwingUtilities;
class TextButton extends JRadioButton

[Code] ....

What i wanted was a JRadioButton with no label carrying around a JTextField. When I added a restore configuration feature in the real program, i found that the text destined for the JTextField was being echoed into the JRadioButton.

Perhaps it is obvious but i sure don't see what I am doing wrong. I am using Java 1.7.0 for development if that makes a difference.

View Replies View Related

How To Add Server Client Relation In Program

Feb 17, 2014

I have to develop a code in parallel which is implemented in sequential yet. How to add the server client relation in the program so that work can be divided into multiple clients.

View Replies View Related

Identify The User From Server Program

Apr 21, 2014

I am doing an multi user chat application, i don't know how to identify the particular pair of user (both end chatting user) among users. and want to send message separately.., which steps i have to fallow, HasMap(); or what is the procedure to achieve my target.

This is my server side program,

Java Code:

import java.util.*;
import java.net.*;
import java.io.*;
public class ChatServer {
Vector<String> users = new Vector<String>();
Vector<HandleClient> clients = new Vector<HandleClient>();
public void process() throws Exception {
ServerSocket server = new ServerSocket(1234);

[Code] ......

View Replies View Related

Client / Server Chat Program

Dec 6, 2014

So i wrote this text to try and create a simple chat program that does the following: Prepend names to messages, announce entrance and exit of chat, display user list, and share a whiteboard.So far the Server seems to be working but the Chat Client is throwing errors at me left and right..

CURRENT ERROR:
Microsoft Windows [Version 6.1.7601]
Copyright (c) 2009 Microsoft Corporation. All rights reserved.

C:Windowssystem32>cd..
C:Windows>cd..
C:>Usersjaydesktopchat
'Usersjaydesktopchat' is not recognized as an internal or external command,
operable program or batch file.

[code]....

View Replies View Related

Debugging Client-server Program In Eclipse

Sep 27, 2014

I've been provided a code skeleton for what must be done, but despite my best efforts to make things work, I'm coming up dry (obviously, due to a lack of knowledge.) One thing that might work is if I knew how to debug this type of application, line-by-line, to see exactly what is going on. Obviously, it's easy enough to debug the client part, but moving over to the server part, I haven't been able to figure that out (I'm using Eclipse.)

Anyways, here's the code I've got so far:

Client.java:
import java.io.*;
import java.net.*;

[code]....

View Replies View Related

Java UDP Client Server Program Not Working

Apr 18, 2014

I am currently writing two java classes (client and server). The client takes an input number form keyboard and sends it to the server. The server then multiplies this number by two and sends it back to the client. The numbers should also be printed to screen along the way, for example if I input the number 3 I should get

"From Client: 3" "From Server: 6"

They should continuously do this unless a negative number is received by the client, say for example the number -3 is sent to the server and it returns -6.

The code I have for the two classes so far is:

import java.io.*;
import java.net.*;
import java.nio.ByteBuffer;
import java.util.Scanner;
class Client {
public static void main(String args[]) throws Exception {
DatagramSocket clientSocket = new DatagramSocket();

[Code] .....

Currently, when I run the program all I get is an output of the number first entered. I am aware it requires a loop but I don't know where and what the condition should be.

Also if I wanted to adapt this so that it would take the integer from client and subtract two at the server and return to client who sends back to server to keep subtracting two unless it reaches a negative number at which point the client will terminate the program - how might I do this.

I do realise there needs to be a while loop in the above code, but I wanted to test it sent the number from client to server and its not doing it. All I get is a print screen of 'enter number' and then the number I enter.

View Replies View Related

Running Program From Server On Client Machine

Aug 9, 2014

I had some questions about a theoretical java program. Say you had a java program on a linux server/pc that referenced a folder on that server. And say you had a Client PC (Windows) that had a share folder to that java program.

If that windows client PC tried to run the program would it run (with a GUI if it had one) and would the main directory of the java program still be on the linux server or would it be on the windows computer since that is the computer that is running the program?

Basically I have a program I am trying to find the best way to run it remotely on a windows computer but it references files on the linux server it is located at and needs to put files it creates there as well. I am just trying to make sure I understand my theory here on how the program will run if it IS run remotely.

View Replies View Related

Instant Messaging Program Between Server And Client

Mar 9, 2015

My overall goal is to create a server that can receive a message from a client and send an automatic reply in captial letters..As well as having the incoming messages decoded to display the header information..The server also needs to save a log of incoming and outgoing commutations..The client needs to be able to attacha text or JPG file and be able to coummucnate with the client.Okay this is what i have so far

client = [URL] .... Cear1v3g
server= [URL] .... hh3uCBqw

I really need them to be able to communicate with each other with messages i am struggling making that work as so far they can talk only to themselves the message aren't getting sent between them, let alone adding the other feutures.

View Replies View Related

Simple Chat Program With Client / Server EOFException

Feb 13, 2015

When I Start Server and login from client everything goes fine but as soon as I want to send amessage or use showIn or even logOut .

Get below error

Exception creating new Input/output Streams: java.io.EOFException

View Replies View Related

FTP Program With Server Is Not Sending Existing Files On Client

Feb 8, 2014

I'm creating ftp program which server will send not existing files on client to him.

There is method responsible for creating connection and sending list of files on client written by me.

Java Code:

[JAVA]//client method
public void enableClient() throws IOException, ClassNotFoundException {
System.out.print("Rozpoczęto działanie klienta");
strIP = jtfIP.getText();
intPort = Integer.parseInt(jtfNrPortu.getText());
clientPath= "C:/serweris/";
sck = new Socket(strIP, intPort);

[Code]....

View Replies View Related

Client-Server Mini Program Is Not Communicating Right - Blocking Read Line Does Not Block?

Feb 3, 2014

Me and my brother decided to make a relatively simple client/server program where clients get into a simple chat lobby and can invite others to play small games(like pong). The basic server code has been written, and we have made a special client that is used for debugging.

We use a self-defined protocol of Strings where a message looks like "4-|user,pass". The number before the delimiter "-|" is the operation code, that tells the server what kind of message this client sends. Based on that number, the server dispatches the message to the appropriate handler method. 4 is authentication for example, and the handler looks the user and pass up in a file and if found, returns true, otherwise, false. Then the server responds to the clinet with 2-|"any message" where the client will recognize opcode 2 as a "authentication accepted" and proceed with the next part of client code. In a similar way, we plan to write all message types(both in the game, in the lobby and in a game setup room).

While testing we ran into a problem where the BufferedReader .readLine() does not seem to be a blocking call like it should be, so the client keeps spamming 'null' in the output field that we made to see the server response to the message we send. When we try to debug the server code and set breakpoints at the suspicious locations, it strangely skips both while(true) loops without activating either breakpoint and executes the finally{} code, even though the client did not close the connection and the second while loop was never entered. The first while loop IS entered though, because the test client gets a "0" on its output, which is the server message indicating "please authenticate yourself".

We decided to use messages in a string format and decode it at both sides as it seemed easier than transmitting java objects and making sure they are of the same type, also for reducing overhead as much of possible.URL....

package Chatroom;
import java.io.BufferedReader;
import java.io.IOException;
import java.io.InputStreamReader;
import java.io.PrintWriter;
import java.net.ServerSocket;
import java.net.Socket;
import java.util.HashSet;

[code]....

View Replies View Related

JSF :: XHTML On One Server Can Talk To Managed-bean On Other Server (different Machine)?

Jul 27, 2014

I am developing a web application using JSF-2.0 on weblogic 10.3.6. I am using Facelets as VDL. I have 5 different machine. They are different according to their OS and their geographical location. On my first xhtml page server (machine) is decided. Then on next page file upload and rest of processing takes place. My restriction is that SSO configuration can be done on only one machine.

So I am restricted to using xhtml files from only my primary server where SSO configuration is done. But I have to connect to servlets or managed-bean of different machine as requests are machine specific and file needs to be uploaded to those machines for processing. So I cannot use redirectUrl as I need to be only on one machine. Is it possible that xhtml on one server can talk to managed-bean on other server(different machine)?.

View Replies View Related

Servlets :: How To Create A Room That Should Be Like Static On The Server Until Server Is Down

Apr 1, 2014

I am working on a chess game. I need to construct a game room where all the player are present and room chat is up. Also some tables where games are being played. Now my question is how to create this game room?

To me this room must need to be like static or global (if I am not mistaken) that is up when server starts and players can join this room and should be down when server is done. How can I implement such room that would stay up for infinite time.

View Replies View Related

Sending To All Vs Sending To One Person In Server / Client Program

Apr 17, 2014

I have two programs that I'll post below, one is a Server and the other is a Client. The ChatServer runs once and many clients can run ChatClient from separate computers and talk together in their GUI's. The the client program comes with two buttons, one that's simulates the sending of a message to a single user ; "Send Message To User", and one that just generally sends a message ; "Send Message To All". Although now the Clients on the server seem to be able to selectively send messages to an individual by giving the recipient name, all the clients can see that message, which is not exact what I am aiming for. What I am going for is having the "Send Message To User" button click to send a message to the named user without all other users seeing the message.

The Server Program Code

import java.io.BufferedReader;
import java.io.IOException;
import java.io.InputStreamReader;
import java.io.PrintWriter;
import java.net.ServerSocket;
import java.net.Socket;
import java.util.ArrayList;

[Code] ....

Now I have tried thing like having various input output streams and trying to connect those, but no luck. Tried fiddling with having the names arraylist directing the messages to one client versus all but that did not work out either. How I what I would need to do to go about doing this?

View Replies View Related

Connect A UDP Web Server To Compression Server

Apr 19, 2015

Working on a project and am in need of some quick guidance to wrap things up. I have a functioning compression server that will create two files after the user gives it some input and a "magic string" to know when to stop reading input for that specific file.

I now need to connect a UDP web server to that compression server. the web server will read from the HTTP POST Request the data that was uploaded and send it to the compression server to create the two files... i have included both programs below

Web Server:

import java.io.*;
import java.net.*;
import java.util.*;
final class HttpRequest implements Runnable {
//Declare Constants and Variables
final static int BUF_SIZE = 1024000;
final static String CRLF = "
";

[Code]...

Compression Server:

import java.net.*; // for DatagramSocket, DatagramPacket, and InetAddress
import java.io.*; // for IOException
import java.util.zip.*;// for Zip
public class CompressionServer {
private static final int ECHOMAX = 65535; // Maximum size of echo datagram
private static final int BUFFER = 2048; // Buffer size for writing to Zip File

[Code]....

View Replies View Related

Servlets :: Need To Set Up A Server

Dec 20, 2014

I am new to Servlets and came across it in Head First Java 2nd Edition. I wrote the servlet code. I don't know how to run it. Do I need to set up a server?

View Replies View Related

SQL Server Error

Jun 16, 2014

Im trying to connect to sql server but i get this error

2014 7:03:38 ΜΜ com.microsoft.sqlserver.jdbc.SQLServerConnection Prelogin
WARNING: ConnectionID:1 ClientConnectionId: 8ee72721-9ec7-41e2-9f57-ebc16d958073 Prelogin error: host localhost port 3306 Unexpected response type:74
url = "jdbc:sqlserver://localhost:3306;user=root;password=root;database=test";

When i try to connect with mysql workbench i connect succesfully.

View Replies View Related

FTP From One To Another Server Using Java

May 10, 2013

I am new to FTP java api. I wanted to do a Ftp transfer from one server to another server using java. I have the connection details for both servers. I found a link with some code but when I try to execute it it throws an error "Couldn't initiate transfer. Check that filenames are valid."

This is the link--> [URL] ....

View Replies View Related

Testing TCP Client And Server

Oct 22, 2014

I am attempting to test a TCP Client and Server for an assignment I am doing in class. The goal here is to "test your client and Server applications by transferring (i) a file having 10,000+ lines (see supplied big-file1.txt having 12000+ lines), (ii) a file having 20,000+ lines (you may create one of your own from big-file1.txt, or obtain a large size file from the Google website at [URL] ...). Then, compute and display the total transfer time of the files at both of the sides separately (your choice in millisecond/second)."

I have created the TCPClient and TCPServer java classes, ran the server first and then the client, and using mathematical formulas to calculate the transfer time. Trouble is, I'm having trouble testing the client and server in the file area and not the area where I had to input a line, let the server print it, and then have the client eliminate the articles from the line. I need testing the file. Here is my code so far:

TCPClient:

package tcpclient;
import java.io.*;
import java.net.*;
public class TCPClient {
public static void main(String[] args) throws IOException{
// TODO Auto-generated method stub
String sentence;

[code] ....

How to fix the code so that the time in seconds does not output as 60 for both files and that the files go through the exchange?

View Replies View Related

Server / Multi Clients

Mar 9, 2014

I have made a server/multi Clients where Clients send Double data but my problem is that the clients send this data to Server only wonce, and the server waits again the connection from client. (I have to run the clients manually each time)what i'm looking: the client should always send data to server. like an infinite loop.

View Replies View Related

How To Run SonarQube Server Using Eclipse

Nov 14, 2014

I'm installing sonarQube in Eclipse indigo, How to run SonarQube in Eclipse Projects and adding sonar plug in into Eclipse IDE.

View Replies View Related

UDP Server Programming In Java

Apr 15, 2015

The goal is as follows: Write a UDP 'CompressionServer' that will take input from the user until it sees a "magic string" at which time it will create a compressed and uncompressed version of the file in the file system.

So, I need to integrate the following "Zip" code in to my UDP server code (which already creates the uncompressed file)... That is where I am stuck at now. My first few attempts had the Zip code after I write to "fout" but that failed to create a ZIP file.

I guess the main point here is what are the key pieces of the ZIP code that I should include and what would be the best spot to place them in my server code...

Zip Code:

import java.io.*;
import java.util.zip.*;

public class Zip {
static final int BUFFER = 2048;
public static void main (String argv[]) {
try {
String fileInput = argv[0];
String fileOutput = argv[1];

[Code] ....

View Replies View Related

EJB / EE :: Websphere Application Server 8

May 22, 2014

i want to use EJB 3 in my WAS8 application but it doesn't work.First of all i created an remote-interface:

import javax.ejb.Remote;
@Remote
public interface EjbTestRemote {
public void doSth();
}

Then i created a session bean class:

import javax.ejb.Stateless;
@Stateless
public class EjbTest implements EjbTestRemote {

[code]....

But now i want to call the session bean from a normal (no servlet, no ejb) java class but i doesn't work (NamingNotFoundException):

try {
Context ctx = new InitialContext();
EjbTestRemote ejbTestLocal = (EjbTestRemote) ctx.lookup("java:comp/env/EjbTest");
ejbTestLocal.doSth();
} catch (NamingException e) {
e.printStackTrace();
}

View Replies View Related

Connect To SSH Server In Java?

Nov 26, 2014

How can I connect to an SSH server in Java? I don't need/want a shell. I just want to connect to the SSH server and get the content of, say, file.txt. How can I do that? Example : I get host, user,pass in txt and connect it with java code!

View Replies View Related

Server For Storing XML Files

Mar 26, 2014

I've the following requirement. A centralized server needs to be established using java code. The server's responsibility is receiving the status of the each client machine as a XML file and storing it in the server's disk space. The client machine also runs the java code to send the status to the server as an XML file in a daily basis. I've planned to create a SOAP webservice in server machine and client machine will invoke the soap webservice to send the status. Do I have to establish any FTP server for storing the XML files? Is there any other better solution for this requirement?

Do I have to establish any FTP server for storing the XML files?

View Replies View Related







Copyrights 2005-15 www.BigResource.com, All rights reserved