Authetication problem in client/server app
I am presently developing a client/server program, and I'm wondering what will be the best form of authentication. I plan to develop a protocol for the programs, any deviation leading to socket closure. I thought about signatures, but I don't think any body's ready to vouch for me(ie I don't know how to go about signatures). Is there any help?
Learn about JAAS
Similar Messages
-
TS3960: Server App or Server Admin can't connect to a newly upgraded Lion server
same problem with mavericks server app....tried additional info solution did not work..any suggestions?
All log in info is correct. will not accept worked fine on 10.8 just upgraded to 10.9 and will not work. deleted and reinstalled server app 3.0.1Figured it out....went to server...settings...check allow remote administration using Server
-
Lotus Notes Client Server Apps
I'm wondering if anyone has tried to connect to lotus notes client server apps. from portal. I've heard that they have to be "webified" first. Is that true or are there different ways to get to the lotus notes app?
Hi,
Please post this on PDK forum.
Thanks,
Sharmila -
How to design socket client-server app for 2-way communication
Hi, I am writing a client-server application. I have a single server and many clients. Each client will need the ability to send information to the server at any time. The server will also need the ability to send information to a client at any time. Its this second part that I am not sure how to design. Would I need to create a SocketServer on each client to accept incoming messages, or is there a better way? Thanks
scranchdaddy wrote:
Don't my requirements sound a lot like an IM application, where a chat server might need to send a message to a chat client at any time?Not really. If that is what you are designing
in my opinion one could easily be forgiven for thinking you were deliberately obfuscating your goal...
How does the server know where the client is? Does it know the IP address of the client?I would imagine the server would contain a directory of IPs? I'm not sure.
What happens if the client is not running?Then I guess the message would not get delivered.
What happens if the client is behind a firewall that does not allow incoming connections?How do IM chat clients work? How have people solved this in the past?Typically the server would only care about clients currently connected to the server.
Maybe you should re-think your design. I don't really have a design, just requirements, that's why I'm writing this post.Your subject says "+How to *design* socket client-server app for 2-way communication+".
Are you saying you expect someone else to do the design for you? -
Integrating DOS/client server apps through portal
Is there any partners out their that have developed any portlets that will integrate legacy client server or DOS through the portlet in a Citrix NFuse fashion?
There seems to be a few competitive portal providers out their who claim that this can be done. OBTree does this via Java wrapped emulation software which can be integrated over the web.
This would be very useful for legacy integration into one place without rewriting a front end etc.
Any ideas or recommendations?Any one got idea how to resolve this problem. We are facing this problem with applet based applications. Pleae let me know if any one know how to write netlet rules to make this app. work through portal.
-
Applet socket problem in client-server, urgent!
Dear All:
I have implemented a client server teamwork environment. I have managered to get the server running fine. The server is responsible for passing messages between clients and accessing Oracle database using JDBC. The client is a Java Applet. The code is like the following. The problem is when I try to register the client, the socket connection get java.security.AccessControlException: access denied(java.net.SocketPermission mugca.its.monash.edu.
au resolve)
However, I have written a Java application with the same socket connection method to connect to the same server, it connects to the server without any problem. Is it because of the applet security problem? How should I solve it? Very appreciate for any ideas.
public class User extends java.applet.Applet implements ActionListener, ItemListener
public void init()
Authentication auth = new Authentication((Frame)anchorpoint);
if(auth.getConnectionStreams() != null) {
ConnectionStreams server_conn = auth.getConnectionStreams();
// Authenticates the user and establishes a connection to the server
class Authentication extends Dialog implements ActionListener, KeyListener {
// Object holding information relevant to the server connection
ConnectionStreams server_conn;
final static int port = 6012;
// Authenticates the user and establishes connection to the server
public Authentication(Frame parent) {
// call the class Dialog's constructor
super(parent, "User Authentication", true);
setLocation(parent.getSize().width/3, parent.getSize().height/2);
setupDialog();
// sets up the components of the dialog box
private void setupDialog() {
// create and set the layout manager
//Create a username text field here
//Create a password text field here
//Create a OK button here
public void actionPerformed(ActionEvent e) {
authenticateUser();
dispose();
// returns the ConnectionStreams object
public ConnectionStreams getConnectionStreams() {
return(server_conn);
// authenticates the user
private void authenticateUser() {
Socket socket;
InetAddress address;
try {
// open socket to server
System.out.println("Ready to connect to server on: " + port);
socket = new Socket("mugca.its.monash.edu.au", port);
address = socket.getInetAddress();
System.out.println("The hostname,address,hostaddress,localhost is:" + address.getHostName() + ";\n" +
address.getAddress() + ";\n" +
address.getHostAddress() + ";\n" +
address.getLocalHost());
catch(Exception e) {
displayMessage("Error occured. See console");
System.err.println(e);
e.printStackTrace();
}Hi, there:
Thanks for the help. But I don't have to configure the security policy. Instead, inspired by a message in this forum, I simply upload the applet to the HTTP server (mugca.its.monash.edu.au) where my won server is running. Then the applet is download from the server and running fine in my local machine.
Dengsheng -
OSX: multi client server app with NSNetService
hello
i have a small osx server app
that uses NSNetService to manage connection and set up streams
but it seems to stop advertising as soon as a clients connects
how can i make it multiclient so it keeps advertising and when a new client connects uses the same streams ?
thanks in advance
nonnussuperdeportivo wrote:
Hello fellahs, as the title of this post says I'm making a client and server application. The server are supposed to handel several clients, and the communication is done true UDP. Out of interest why have you chosen UDP rather than TCP?
I have got two questions concerning this. The first one is if a exception is throws in the server should I then send the exception back to the client in serialized form. If I choose to do this then I also would need to handel the exception classen to the client. Or should I send back a regular IOException and use it's init cause to define the exception which occured in the server. That is up to you, you can do either. I would do the first option.
The second question is concerning the multi client support. If this is going to work then I would need to time-out the connection i the server environment, and I have not a clue about how long it should be?It should be long enough that you don't timeout a valid connection. There is no simple answer to this. -
Creating chart in java client/server app.
Currently, I'm developing a client/server java app. under windows. I want to create a chart (pie, bar) for graphically reporting, anybody can help me pls........? Thanks a lot
TriAKThere are some solutions...You can use the Java Chart() class or BarChart() from the J2sdk API.
(http://java.sun.com/applets/jdk/1.4/demo/applets/BarChart/example1.html)
Besides, you can use some already build class from some companies like ObjectPlanet.(www.objectplanet.com).
There is also another link(have a look at it) http://www.java4less.com/charts_e.htm
Another way is to build by your own using java.awt(It will be to most difficult in the manner of time consumed).
Finally, I will recommend you to create charts as html page integrate this application as Applet or html in general(Javascript,JSP).
I hope I gave you some ideas. -
Help Needed With Basic Client/Server App
I was wondering if anyone can help with a simple blackjack client/server application i've been writting (basically its a moddified chat application). The problem i'm having seems to lie within the connection management i've written.
What i'm trying to get is that only 4 players can connect at one time and that each player takes a turn (which i've implemented using threads) to play their hand (as you would if you were playing it for real). The problem is that it will allow the players to connect, but oddly enough, it will not allow a new transaction to be created (i.e. allow a player to take their turn) until 2 players have connected.
Even when it does create the transaction, after taking input from the client once, the server seems to stop doing anything without any error message of any kind.
Its really annoyed me now, so you guys are my last hope!
The code can be found in full here:
Client Application: http://stuweb3.cmp.uea.ac.uk/~y0241725/WinEchoClient.java
Server Application: http://stuweb3.cmp.uea.ac.uk/~y0241725/ThreadServer.java
Card Class: http://stuweb3.cmp.uea.ac.uk/~y0241725/Card.java
Deck Class: http://stuweb3.cmp.uea.ac.uk/~y0241725/Deck.java
Please feel free to play around with this code as much as you feel necessary!(one last bump back up the forum before i give up on this completely)
-
Problem with client\ server program
hello,
i have two programs one client and the other is server but i can't connect between client and server
how can i connect between client and server ??
this programs run in jbuilderwhat type of client u r using.WHich server u r using to run u r programs.If u r client and server is simple java client then u can use Socket to client to server.Otherwise u can use jsp/servlet to connect to the app /web server comm'n
Anand -
Using Class Timer in a client/server app
In my program i d like the server execute draws every 5 min choosing numbers randomly from1 to 10.
Clients, when connected will inform server about the number they chose. (This works correctly)
Next, the clients will wait until notified by the server about the number drawn in the last draw and
about if they won or not.
i ve found that i have to use classes Timer and TimerTask but API does not help me enough
about how to use them. Could anyone help me?
Here is the piece of code i think it need to be changed.
// control thread's execution
public void run()
int message=0;
int rnum=randGen.nextInt(10);
display.append( "\n"+ "THE MAGIC NUMBER IS: " + rnum );
// process connection
try {
// read message from client
do {
try {
message = input.readInt();
if (message==rnum){output.writeUTF("SERVER>>> YOU WON: MAGIC NUMBER IS: " +rnum);}
else {output.writeUTF("SERVER>>> YOU LOSE: MAGIC NUMBER IS: " +rnum);}
display.append( "\n\n" +"PLAYER " + clientNumber + " SELECTED NUMBER " + message );
display.setCaretPosition( display.getText().length() );
// process problems reading from client
catch ( IOException ioException ) {
display.append( "\nUnknown object type received" );
} while ( message!=-1 );
display.append( "\nClient terminated connection" );
display = null;
// close streams and socket
finally {
try {
output.close();
input.close();
connection.close();
// process problems with I/O
catch ( IOException ioException ) {
ioException.printStackTrace();
clients.remove( this );
} // end method run
I just implemented something like this so I know what you are trying to do.
Basically TimerTask is an Abstract class, which means you can't make an instance of it. So TimeTask t = new TimeTask() won't work. Instead what you need to do is make your own class that extends TimerTask. You then need to implement the run() method which is abstract in TimerTask.
This sounds complicated at first, but it is very easy.
This is my DelayTimerTask:
import java.util.TimerTask;
*Author: Jon Parise
*email: [email protected]
public class DelayTimerTask extends TimerTask{
private boolean timeExpired = false;
/** Creates a new instance of DelayTimerTask */
public DelayTimerTask() {
timeExpired =false;
public void run(){
timeExpired =true;
public boolean isExpired(){
return this.timeExpired;
}All this class does is set a flag when it is run.
The Timer class schedules a TimerTask, in this case a DelayTimer. When the scheduled time comes, everything in run is executed, which in this case sets the flag.
To schedule the task do this:
Timer delayTimer = new Timer();
DelayTimerTask delayTimerTask = new DelayTimerTask();
delayTimer.schedule(delayTimerTask,5000);
while(!delayTimerTask.isExpired()){
//DoSomething Here
}This will create a new delayTimer, and then schedule it to go off in 5 seconds(5000 millaseconds). When it goes off isExpired will become true and break you out of the loop.
Hope this helps,
Jon -
Making a Client & Server app with UDP
Hello fellahs, as the title of this post says I'm making a client and server application. The server are supposed to handel several clients, and the communication is done true UDP.
I have got two questions concerning this. The first one is if a exception is throws in the server should I then send the exception back to the client in serialized form. If I choose to do this then I also would need to handel the exception classen to the client. Or should I send back a regular IOException and use it's init cause to define the exception which occured in the server.
The second question is concerning the multi client support. If this is going to work then I would need to time-out the connection i the server environment, and I have not a clue about how long it should be?
/thanks in regards Ali.superdeportivo wrote:
Hello fellahs, as the title of this post says I'm making a client and server application. The server are supposed to handel several clients, and the communication is done true UDP. Out of interest why have you chosen UDP rather than TCP?
I have got two questions concerning this. The first one is if a exception is throws in the server should I then send the exception back to the client in serialized form. If I choose to do this then I also would need to handel the exception classen to the client. Or should I send back a regular IOException and use it's init cause to define the exception which occured in the server. That is up to you, you can do either. I would do the first option.
The second question is concerning the multi client support. If this is going to work then I would need to time-out the connection i the server environment, and I have not a clue about how long it should be?It should be long enough that you don't timeout a valid connection. There is no simple answer to this. -
Hi
i would like to discuss some ways to help improve the connection between a mobile device and a remote server using sockets and http connection.
on my N95 device and on T mobile network, i sometimes struggle to connect to the remove server and was wondering if there is a way to improve this.
would using UDP be ideal has i have heard from someone that TCP is generely not good for wireless connections. what wil be the best approach to improve the perfiormance of wireless devices communicating with a remote server? thankshi. first and foremost, both tcp & udp need internet connection irrespective of there modes of operations. tcp is connection oriented since the server has to be in constant communication with the client due to acknowledgement issues while udp does not need acknowledgement. now according to my experience the whole issue is with the cellular service provider companies; they need to make their networks efficient. in my country the internet just stops being there for some several minutes before it resumes and under such circumstances i think both tcp and udp are bound to affected.
-
Client/Server apps using custom objects
I have wrote an ip transaction server and I am trying to pass objects across to it that don't have to reside on the server. I have created an interface that implements serializable and then the class I am trying to pass implements the interface. I read that as long as the interface is on both the client and the server that the object doesn't need to be using this approach.
I, however, keep getting a classdefnotfound error for the custom object when I do a readObject().
Can this really be done?
Thanks in advance.
Relevant code snippets:
interface Workable implements java.io.Serializable
public abstract int getToWork();
public class test1 implements Workable
public int getToWork()
System.out.println("Test 11 value = ");
return 1;
Server code:
Workable ipdata;
ipdata = (Workable)in.readObject();//Blows up trying to read object here
ipdata.getToWork();Take a look at the thread on this newsgroup named:
deserialization loads classes more eagerly than construction?
That seems similar to your complaint (Java's object serialization not conforming to its own specs about "classes that don't need to be present", in that thread it is a non-serializable member object that blocks things). I get the feeling you hit a bug in Java's serialization mechanism and that it is caused by a faulty heuristic in Java serialization. -
Large file transfer problems over client/server socket
Hi,
I wrote a simple chat problem in which I can send files from client to client. The problem is when I send large files over 101 MB the transfer freezes. I do not even get any error mesages in the console. The files I am sending are of any type (Ex mp3, movies, etc...). I am serializing the data into a "byteArray[packetSize]" and sending the file packet by packet until the whole file has been sent, and reconstructed on the other side. The process works perfectly for files smaller than 101MB, but for some reason freezes after that if the file is larger. I have read many forums and there aren't too many solutions out there. I made sure to use the .reset() method to reset my ObjectOutputStream each time I write to it.
Here's my file sending code:
byte[] byteArray = new byte[defaultPacketSize];
numPacketsRequired = Math.ceil(fileSize / defaultPacketSize);
try {
int i = 0;
reader = new FileInputStream(filePath);
while (reader.available() > 0) {
if (reader.available() < defaultPacketSize) {
byte[] lastPacket = new byte[reader.available()];
reader.read(lastPacket);
try {
if (socket == null || output == null) {
throw new SocketException("socket does not exist");
output.writeObject(lastPacket);
output.reset();
output.writeObject("DONE");
output.reset();
output.close();
socket.close();
catch (Exception e) {
System.out.println("Exception ***: " + e);
output.close();
socket.close();
else {
reader.read(byteArray);
try {
if (socket == null || output == null) {
throw new SocketException("socket does not exist");
output.writeObject(byteArray);
output.reset();
catch (Exception e) {
System.out.println("Exception ***: " + e);
output.close();
socket.close();
reader.close();
catch (Exception e) {
System.out.println("COULD NOT READ PACKET");
Here's my file receiving code:
try {
// The message from the client
Object streamInput;
FileOutputStream writer;
byte[] packet;
while (true) {
streamInput = input.readObject();
if (streamInput instanceof byte[]) {
packet = (byte[]) streamInput;
try {
writer = new FileOutputStream(outputPath, true);
writer.write(packet); //Storing the bytes on file
writer.close();
catch (Exception e) {
System.out.println("Exception: " + e);
else if (streamInput.equals("DONE")) {
socket.close();
input.close();
break;
catch (Exception e) {
I'm looking for any way I can possibly send large files from client to client without having it freeze. Are there any better file transfer ways other than socket? I don't really want FTP. I think I want to keep it HTTP.
Any suggestions would be helpful.Thanks!
EvanI've taken a better look a the code you posted, and
there is one problem with the receiving code. You
keep repeatedly opening and closing the
FileOutputStream. This is not going to be efficient
as the file will keep needing to be positioned to its
end.Yes sorry I did change that code so that it leaves the file open until completely done writing. Basically I have a progress bar that records how far along in the writing process the client is, and when the progress bar reaches 100%, meaning the file is complete, the file.close() method is invoked. Sorry about that.
I also ran some memory tests using the "Runtime.getRuntime().totalMemory()", and "Runtime.getRuntime().freeMemory()" methods. I put these methods inside the loop where I read in the file and send it to the client. here's the output:
Sender's free memory: 704672
File reader read 51200 bytes of data.
767548 left to read.
Sender's runtime memory: 2818048
Sender's free memory: 702968
File reader read 51200 bytes of data.
716348 left to read.
Sender's runtime memory: 2818048
Sender's free memory: 701264
File reader read 51200 bytes of data.
665148 left to read.
Sender's runtime memory: 2818048
Sender's free memory: 699560
File reader read 51200 bytes of data.
613948 left to read.
Sender's runtime memory: 2818048
Sender's free memory: 697856
File reader read 51200 bytes of data.
562748 left to read.
Sender's runtime memory: 2818048
Sender's free memory: 696152
File reader read 51200 bytes of data.
511548 left to read.
Sender's runtime memory: 2818048
Sender's free memory: 694448
File reader read 51200 bytes of data.
460348 left to read.
Sender's runtime memory: 2818048
Sender's free memory: 692744
File reader read 51200 bytes of data.
409148 left to read.
Sender's runtime memory: 2818048
Sender's free memory: 691040
File reader read 51200 bytes of data.
357948 left to read.
Sender's runtime memory: 2818048
Sender's free memory: 689336
File reader read 51200 bytes of data.
306748 left to read.
Sender's runtime memory: 2818048
Sender's free memory: 687632
File reader read 51200 bytes of data.
255548 left to read.
Sender's runtime memory: 2818048
Sender's free memory: 685928
File reader read 51200 bytes of data.
204348 left to read.
Sender's runtime memory: 2818048
Sender's free memory: 684224
File reader read 51200 bytes of data.
153148 left to read.
Sender's runtime memory: 2818048
Sender's free memory: 682520
File reader read 51200 bytes of data.
101948 left to read.
Sender's runtime memory: 2818048
Sender's free memory: 680816
File reader read 51200 bytes of data.
50748 left to read.
Sender's runtime memory: 2818048
Sender's free memory: 679112
File reader read 50748 bytes of data.
0 left to read.
Creating last packet of size: 50748
Last packet size after setting it equal to byteArray: 50748
Here's the memory stats from the receiver:
Receiver's free memory: 639856
Receiver's total memory: 2842624
Receiver's free memory: 638920
Receiver's total memory: 2842624
Receiver's free memory: 637984
Receiver's total memory: 2842624
Receiver's free memory: 637048
Receiver's total memory: 2842624
Receiver's free memory: 636112
Receiver's total memory: 2842624
Receiver's free memory: 635176
Receiver's total memory: 2842624
Receiver's free memory: 634240
Receiver's total memory: 2842624
Receiver's free memory: 633304
Receiver's total memory: 2842624
Receiver's free memory: 632368
Receiver's total memory: 2842624
Receiver's free memory: 631432
Receiver's total memory: 2842624
Receiver's free memory: 630496
Receiver's total memory: 2842624
Receiver's free memory: 629560
Receiver's total memory: 2842624
Receiver's free memory: 628624
Receiver's total memory: 2842624
Receiver's free memory: 627688
Receiver's total memory: 2842624
Receiver's free memory: 626752
Receiver's total memory: 2842624
Receiver's free memory: 625816
Receiver's total memory: 2842624
Receiver's free memory: 624880
Receiver's total memory: 2842624
Receiver's free memory: 623944
Receiver's total memory: 2842624
Receiver's free memory: 623008
Receiver's total memory: 2842624
Receiver's free memory: 622072
Receiver's total memory: 2842624
Receiver's free memory: 621136
Receiver's total memory: 2842624
Receiver's free memory: 620200
Receiver's total memory: 2842624
Receiver's free memory: 619264
Receiver's total memory: 2842624
Receiver's free memory: 618328
Receiver's total memory: 2842624
Receiver's free memory: 617392
Receiver's total memory: 2842624
Receiver's free memory: 616456
Receiver's total memory: 2842624
Receiver's free memory: 615520
Receiver's total memory: 2842624
Receiver's free memory: 614584
this is just a sample of both receiver and sender's stats. Everything appears to be fine! Hope this message post isn't too long.
Thanks!
Maybe you are looking for
-
How to create Using Formatted Text Field with multiple Sliders?
Hi i found the Java Sun tutorial at http://java.sun.com/docs/books/tutorial/uiswing/components/slider.html very useful, and it tells how to create one Formatted Text Field with a Slider - however i need to create Formatted Text Field for multiple Sli
-
BW BEX Queries and Analysis Authorizations
Hello.... Have an opportunity with BW BEX queries and Analysis Authorization...would like to see if anyone has had the same experience and if so is there a answer.... 1) given a query.... 2) given a analysis authorization with a info-object that has
-
From Unicode to IS08859_1 conversion
Hi everybody! I'm trying simply to correctly display some special characters like �,�,�,�,�,�. I can decode correctly any RFC2047 compliant string, but the output string is in Unicode(UTF8) format, since this is the Java's native charset. Then I trie
-
i cant not get into my app store because it keep asking for my billing info an when i put it in again it pops back up asking for my billing info again
-
Is there a standard delivered Glossary iView that I can use like for example portal terminology? I can see that this is available on SDN. Regards, James