Client/server

Hi, i am doing a client/server arc .I have a server , that will connected to the oracle , using jdbc.The client here is an application, how do i change it to applet?
The server code
import java.sql.*;
import java.util.Properties;
import java.io.*;
import java.net.*;
public class CommentsServer extends Thread {
public static final int DEFAULT_PORT = 7777;
protected int port;
protected ServerSocket server;
String username ="combtest";
String password = "combtest";
public static void main (String args[]) {
int port=0;
if (args.length == 1) {
try {
port = Integer.parseInt (args[0]);
} catch (NumberFormatException e) { }
try {
     Class.forName("oracle.jdbc.driver.OracleDriver");
String sourceURL ="jdbc:oracle:thin:@klm:1521:KLMPMIS";
String user="combtest";
String password="combtest";
catch (Exception e) {
System.err.println("Failed to load JDBC driver.");
System.exit (1);
new CommentsServer (port);
public CommentsServer (int port) {
super ("Comments Server");
if (port == 0)
port = DEFAULT_PORT;
this.port = port;
try {
server = new ServerSocket (port);
} catch (IOException e) {
System.err.println ("Error creating server");
System.exit (1);
start();
public void run() {
System.out.println ("Server Running");
ThreadGroup connections = new ThreadGroup ("Comment Connections");
connections.setMaxPriority(this.getPriority()-1);
try {
while (true) {
Socket client = server.accept();
System.out.println ("Connection from: " + client.getInetAddress().getHostName());
CommentsConnection c = new CommentsConnection (connections, client);
} catch (IOException e) {
System.err.println ("Exception listening");
System.exit (1);
System.exit (0);
class CommentsConnection extends Thread {
static int counter = 0;
protected ObjectInputStream in;
protected PrintWriter out;
public CommentsConnection (ThreadGroup group, Socket client) {
super (group, "Connection " + counter++);
try {
in = new ObjectInputStream (client.getInputStream ());
out = new PrintWriter (client.getOutputStream(), true);
} catch (IOException e) {
try {
client.close();
} catch (IOException e2) { }
System.err.println ("Unable to connect.");
return;
start();
public void run () {
try {
String mode = (String)in.readObject();
if (mode.equals("insert")) {
     String name=(String)in.readObject();
try {
     String u="jdbc:oracle:thin:@klm:1521:KLMPMIS";
     Connection con=DriverManager.getConnection(u,"combtest","combtest");
     PreparedStatement prep=con.prepareStatement("Insert into TEST values(?)");
     prep.setString(1,name);
     if(prep.executeUpdate()!=1)
     throw new Exception("Bad update");
} catch (Exception e) {
out.println ("Error updating: " + e);
return;
} else if (mode.equals("query")) {
try {
     Connection con=DriverManager.getConnection("jdbc:oracle:thin:@klmsph1:1521:KLMPMIS","combtest","combtest");
Statement statement=con.createStatement();
ResultSet result=statement.executeQuery("SELECT * FROM TEST");
out.println("Name");
int nameCol=result.findColumn("NAME");
String name,user,comments;
while(result.next())
     name=result.getString(nameCol);
     out.println(name);
statement.close();
con.close();
} catch (Exception e) {
out.println ("Error querying: " + e);
return;
} else {
out.println ("Invalid Command: " + mode);
} catch (Exception e) {
out.println ("Error reading Stream: " + e);
out.close();
the client code
import java.net.*;
import java.io.*;
import javax.swing.*;
import java.awt.*;
import java.awt.event.*;
public class CommentsClient extends JApplet{
TextArea ta;
TextField name;     
public static final int DEFAULT_PORT = 7777;
private static final String QueryString = "query";
private static final String InsertString = "insert";
private int port = 0;
private String host = null;
private OutputStream os = null;
public CommentsClient (String host, int port, OutputStream os) {
this.host = host;
this.port = ((port == 0) ? DEFAULT_PORT : port);
this.os = os;
query();
public CommentsClient (String host, int port, OutputStream os,
String name) {
this.host = host;
this.port = ((port == 0) ? DEFAULT_PORT : port);
this.os = os;
insert(name);
private void query () {
PrintWriter out = new PrintWriter (os, true);
try {
Socket s = new Socket (host, port);
ObjectOutputStream oos = new ObjectOutputStream (s.getOutputStream());
// PrintWriter out=new PrintWriter(s.getOutputStream(),true);
oos.writeObject (QueryString);
oos.flush();
BufferedReader in = new BufferedReader (new InputStreamReader (s.getInputStream()));
String line;
while ((line = in.readLine()) != null) {
out.println (line);
out.close();
s.close();
} catch (IOException e) {
out.println ("Error querying." + e);
return;
private void insert (String name) {
PrintWriter out = new PrintWriter (os, true);
try {
Socket s = new Socket (host, port);
ObjectOutputStream oos = new ObjectOutputStream (s.getOutputStream());
oos.writeObject (InsertString);
oos.writeObject (name);
oos.flush();
BufferedReader in = new BufferedReader (new InputStreamReader (s.getInputStream()));
String line;
while ((line = in.readLine()) != null) {
out.println (line);
oos.close();
s.close();
} catch (IOException e) {
out.println ("Error inserting." + e);
return;
public static void main (String args[]) {
if (args.length == 0) {
CommentsClient cc = new CommentsClient ("localhost", 0, System.out);
} else if (args.length == 1) {
CommentsClient cc = new CommentsClient ("localhost", 0, System.out, args[0]);
the applet (acts as an interface)
import java.awt.*;
import java.awt.event.*;
import java.applet.Applet;
import java.io.*;
//<applet code = "CommentsApplet" width = 800 height = 600>
//</applet>
public class CommentsApplet extends Applet {
TextArea ta;
TextField name;
TextField user;
TextField comments;
public void init () {
Panel p1 = new Panel(new BorderLayout(10, 10));
Button b1 = new Button ("Query");
p1.add (b1, BorderLayout.SOUTH);
ta = new TextArea ();
ta.setEditable(false);
p1.add (ta, BorderLayout.CENTER);
b1.addActionListener (new ActionListener() {
public void actionPerformed (ActionEvent e) {
ByteArrayOutputStream bao = new ByteArrayOutputStream();
CommentsClient cc = new CommentsClient ("localhost", 0, bao);
ta.setText (bao.toString());
add (p1);
Panel p2 = new Panel (new BorderLayout (10, 10));
Button b2 = new Button ("Insert");
p2.add (b2, BorderLayout.SOUTH);
Panel p3 = new Panel();
name = new TextField ("", 10);
p3.add (name);
p2.add (p3, BorderLayout.CENTER);
b2.addActionListener (new ActionListener() {
public void actionPerformed (ActionEvent e) {
ByteArrayOutputStream bao = new ByteArrayOutputStream();
CommentsClient cc = new CommentsClient ("localhost", 0, bao, name.getText());
ta.setText (bao.toString());
add (p2);
the html file
<html>
<body>
<hr>
<applet
code=CommentsApplet.class
width = 400
height = 400
>
</applet>
<hr>
</body>
</html>
Thanks in advance,
Jessy

hi
I have no idea what you are doing. Strange programming
public class CommentsClient extends JApplet why does it extends JApplet when it isn't a JApplet but an application
and why is there a second applet
public class CommentsApplet extends Applet (should this be extends JPanel??)
but for normal classes this is the procedure
rename the constructor in "public void init()" the method init is automaticly called by the browser.
remove the main method if there is some code in the main method that needed move it to the init method. ( in your case the arguments can't be read from the command line but must be read out of the *.html file )

Similar Messages

  • Client/Server to Web-Based application Conversion

    Hi! Everyone,
    I have couple of questions for you guys.
    Our Client had recently upgraded Forms 4.5 to 6i to move from Client/Server based application to Web based application.
    They are using Forms Server 6i Patch Set 1, OAS 4.0.8.1, Windows NT Service Pack 5 and Oracle 7.3. They are facing the following error every now and then, when they run the forms,
    "FRM-92100: Your connection to the server was interrupted. This may be the result of a network error or a failure on the server.You will need to re-establish your session."
    Please let me know what might be causing the above error. The only problem i can think about might be Oracle 7.3. If i am right only Oracle 8 and above supports Forms 6i.
    Can anyone let me know some tips and/or techniques to upgrade Forms 4.5 to 6i. If there are any important settings/steps which we might have over looked during the upgrade, please list them.
    Any kind of help is greatly appreciated.
    Thanks,
    Jeevan Kallem
    [email protected]

    Most of the code is use with no changes at all.
    See otn.oracle.com/formsupgrade
    Regards
    Grant Ronald

  • Client/server program validation - is it possible?

    I've been mulling over this problem for a few days, and am starting to wonder if it's theoretically possible to find a solution. I'm not looking for specific code, this probably won't even be implemented in Java, I'm just wondering if there is a theoretical program model that would work in this situation.
    The short version:
    Validate the data generated by a client program, without knowing the original data.
    The long version:
    This is a "profiling" system for a MMOG (Massively Multiplayer Online Game). The MMOG is an internet based client/server graphical program where each client connects to the server and they interact with each other and the virtual world. They pay a monthly fee for access to the game. My program is not affiliated with the MMOG or its makers. I have no connections inside the company and cannot expect any cooperation from them.
    The "profiling" system is also a client/server model. The client program runs in the background while the MMOG client is active. It accesses the memory of the MMOG client to retrieve information about the player's character. Then, possibly on request or maybe immediately, it sends the character data to our server.
    What I want to validate is that the character data being sent is unmodified and actually comes from the MMOG program.
    I can reasonably expect that with mild encryption and some sort of checksum or digest, the vast majority of problems can be avoided. However, I am not sure it's possible to completely secure the system.
    I assume that the user has access to and knowledge of the profiler client and the MMOG client, their assembly code, and the ability to modify them or create new programs, leveraging that knowledge. I also assume that the user does not have access to or knowledge of either of the server applications - the MMOG server or mine.
    In a worst-case scenario, there are several ways they could circumvent any security I have yet been able to think of. For instance, they could set up a fake MMOG client that had the data they wanted in memory, and let the profiler access that instead of the real thing. Or, they could rewrite the profiler to use the data they wanted and still encrypt it using whatever format I had specified.
    I have been considering using some kind of buffer overflow vulnerability or remote execution technique that would allow me to run specific parts of the client program on command, or get information by request, something that could not be anticipated prior to execution and thus could not be faked. But this seems not only insecure for the client but also not quite solid enough, depending on how it was implemented.
    Perhaps a series of apparently random validation codes, where the client does not know which one actually is doing the validation, so it must honor them all. Again, this is very conceptual and I'm sure that I'm not explaining them very well. I'm open to ideas.
    If I don't come up with anything better, I would consider relying on human error and the fact that the user will not know, at first, the relevance of some of the data being passed between client and server. In this case, I would include some kind of "security handshake" that looks like garbage to the client but actually is validated on the server end. A modified program or data file would result in an invalid handshake, alerting the server (and me) that this client was a potential problem. The client would have no idea anything had gone wrong, because they would not know what data the server was expecting to receive.
    I hope I have not confused anyone too much. I know I've confused myself....

    Yes, that is the general model for all MMOGs these days - no data that can actually affect the game is safe if loaded from the client's computer. All character and world data is sent from server to client and stored in memory. Any information that is saved to the client's computer is for reference only and not used by the game engine to determine the results of actions/events etc.
    My program accesses the MMOG client's memory while the game is running, and takes the character information from there. It does not have direct access to the MMOG server, and does not attempt to modify the data or the memory. Instead, it just encrypts it and sends it to our server, where the information is loaded into a database.
    The security issue comes into play because our database is used for ranking purposes, and if someone were to hack my program, they could send invalid data to our servers and affect the rankings unfairly.
    I'm just trying to think of a way to prevent that from happening.

  • SENDING EMAIL USING ORACLE9i CLIENT/SERVER

    I HAVE DOWNLOADED 2 UTILITY LIBRARIES D2KCOMN and D2KWUTIL TO MY COMPUTER. THESE 2 LIBRARIES ARE COPIED TO AN ORACLE FORM. ON THE FORM, THERS IS A BUTTON. IN THE WHEN-BUTTON-PRESSED-TRIGGER, I HAVE CODED
    WIN_API_SHELL.WINEXEC('"C:\PROGRAM FILES\MICROSOFT OFFICE\OFFICE\OUTLOOK.EXE"-c IPM.Note/m"'||:email.recipient_name||'&cc='||
    :email.recipient_name2||'&subject='||:email.subject||
    '&body='||:email.mes||'"',WIN_API.SW_SHOWNORMAL,TRUE);
    :email.recipient_name,
    :email.recipient_nam2,
    :email.subject, and
    :email.mess
    ARE FIELDS ON THE ORACLE FORM.
    THE NAMES ARE DEFINED BY THE PROGRAMMER.
    THE NAMES OF THE FIELDS ARE NOT RESERVED WORDS.
    WHEN THE CODE IS EXECUTED, MICROSOFT OUTLOOK IS OPENED AND THE RECIPIENT LINE, COURTESY COPY LINE, SUBJECT LINE
    AND BODY OF A NEW MESSAGE ARE PREPOPUTATED WITH THESE FIELDS FROM AN ORACLE FORM.
    THIS ROUTINE WORKS FINE ON AN ORACLE6i CLIENT SERVER BUT IT WILL NOT WORK WELL ON AN ORACLE9i CLIENT SERVER.
    WHAT DO I NEED TO DO TO CHANGE MY CODE? DO I NEED TO USE NEW UTILITY LIBRARIES? I WOULD SURE LIKE TO KNOW WHAT TO DO.

    Oracle9i Forms does not support client server - so you are running in a different environment (even though you may still only be onl two tiers).
    Regards
    Grant Ronald
    Forms Product Management

  • VPN Site-to-Site or VPN Client Server with Cisco IP Phone 8941 and 8945

    Hi everyone,
    I decide to deploy a CUCM (BE6K platform), SX20, and IP Phone 8941/8945 on Head Office and Cisco SX10 and IP Phone 8941/8945 for branch offices (actually 9 branch offices).
    The connection will use internet connection for HO and each branch offices.
    And the IT guy want to use kind a VPN client server or VPN site-to-site for the connection through internet,
    what kind of VPN client server or VPN site-to-site that recommended for this deployment?
    and what type of Cisco router that support that kind of VPN (the cheapest one will be great)?
    So the SX10 and IP Phone 8941/8945 in branch offices can work properly through internet connection?
    please advise
    Regards,
    Ovindo

    Hi Leo,
    technically, the ipsec users will not use up any premium license seats, so if you have 10 ipsec users connecting first, the premium seats are still free and so you can then still have 10 phones/anyconnect users connect.
    However, the 250 you mention is the global platform limit, so it refers to the sum of premium and non-premium connections. Or in other words, you can have 240 ipsec users and 10 phones,  but not 250 ipsec users and 10 phones.
    If 250 ipsec users and 10 phones would try to connect, it would be first-in, first-served, e.g. you could have 248 ipsec users and 2 phones connected.
    Note: since you have Essentials disabled I'm assuming you are referring to the legacy "Cisco vpnclient" (IKEv1 client) which does not require any license on the ASA. But for the benefit of others reading this thread: if  you do have Anyconnect clients (using SSL or IPsec/IKEv2) for which you currently have an Essentials license, then note that the Essentials and Premium license cannot co-exist. So for e.g. 240 Anyconnect users and no phones, you can use Essentials. For 240 Anyconnect users and 10 phones, you need a 250-seat Premium license (and a vpn phone license).
    hth
    Herbert

  • How to delete the workbench client server name in FDM

    Hi Gurus
    How to delete/change the workbench client server name in FDQM?
    regards
    Sarilla

    OK, I understand now. You are referring to the Load Balance Server Group. Yes, this can be done:
    a) Browse to Oracle\Middleware\EPMSystem11R1\Products\FinancialDataQuality\SharedComponents\Config
    b) Locate the LoadBalanceServerGroups.xml file
    You can delete this file. The next time the workbench is launched it will ask you to set the load balance server group again and will create this file again.

  • Which keys are used in Client/Server Authentication?

    Hi.
    I am trying to understand how SunX509 algorithm works in a TLS context. When Server or Client authentication is done, which keys of the keystore are used?
    I mean, when you set up your KeyStore instance, it is loaded a whole KeyStore from the filesystem, which has a lot of keys to be used. Are they all tried in order to find the key that authenticates the Client/Server, and when a key that works is found means that Client/Server is authenticated? Or a concrete key with a specific alias is used?
    Do you know a doc or something similar where i can see this explanation? I haven't found this matter in JSSE API User's Guide nor in JSSE Javadocs.
    Thanks!

    The alias that is chosen is arbitrary and depends upon the order in which the aliases are returned via a hashtable enumeration. If you want to make sure you're using a particular aliasn you must write your own key manager, take a look at the X509KeyManager interface with methods such chooseClientAlias(), chooseServerAlias(), ...

  • Looking for a client/server that supports multiple protocol and delivery

    Hi all, I don't know if this the right place to ask my question,here it goes.
    I am looking to develop a client-server that supports multiple protocols such as HTTP, HTTPS etc. I am looking for a framework( i don't know if that is correct or I need some kind of web-service (soap etc)) that would manage connection, security etc. I would like to like to devote most of my time in developing business objects with multiple delivery mechanism such as sending serilized java objects, xml message or soap message, or in some case JMS message as well. So I need a client server that can come in via TCP/IP or HTTP or anyother industry standard protocol and I should be able to service him with pub/sub model and also request/response model as well.
    I don't know if I had explained what I need, I would like to know what technologies I should be evaluating and which direction I should be heading... Also the server I'm developing should be free of Java constraints if needed...
    Also this service is not webbased service as now but if need arises I should have a flexibilty to make them web enabled in future. Also I would like to work with open source webservers or appservers if I need

    Inxsible wrote:I installed i3 - along with the i3status - which I still have to figure out. I am liking what I see as of now. It reminds me of wmii -- when I used it way back when. However I do not like the title bar. I would much rather prefer a 1 px border around the focused window.
    "i3 was created because wmii, our favorite window manager at the time, didn't provide some features we wanted (multi-monitor done right, for example), had some bugs, didn't progress since quite some time and wasn't easy to hack at all (source code comments/documentation completely lacking). Still, we think the wmii developers and contributors did a great job. Thank you for inspiring us to create i3. "
    To change the border of the current client, you can use bn to use the normal border (including window title), bp to use a 1-pixel border (no window title) and bb to make the client borderless. There is also bt  which will toggle the different border styles.
    Examples:
    bindsym Mod1+t bn
    bindsym Mod1+y bp
    bindsym Mod1+u bb
    or put in your config file
    new_window bb
    from: http://i3.zekjur.net/docs/userguide.html (you probably already found that by now )

  • Client-Server - SOA.... Is it really a transition or a big development  ?

    Hi,
    In all sources related to SOA/ESA by SAP, it is said that, transitioning from Client-Server Arch(CSA) to SOA is the same as transitioning from Mainframe systems to Client-Server Arch.
    If we think about Mainframe and CSA, it is obvious that there had been big differences in that transition. Such as, the INTELLIGENT CLIENT concept had appeared to replace the DUMMY CLIENTS, so this had changed the way of IT Business. There would be a main application providing several functionalities(server) and other applications which want to use those functionalities (clients) would connect to the server using some functionalities on its own (that means a client appliction should also have some functionalities in order to at least connect to the server, so that made them different from the DUMMY clients of the mainframe era)
    Now, when I look at the differences between SOA and CSA, I cannot see that incompareble differences.Why ? Let me explain :
    - One of the most important differences between SOA and CSA is, SOA is vendor and platform independent, so that any application can call any applications functionality as long as they are using Web Services. That is true. But the question arises here : It is still the case that someone is calling some others' functionalities (services), so there is still a client/server mentality, isn't there and We will still be using several client/server programming languages in order to realize the main functionality of the web services but this will be transparent to the user and the integration. The main difference is, SOA is vendor and platform independent. But I don't think this can be commented as a missing feature of CSA. Because the aim of CSA was to make the clients more intelligent and not to make them vendor/platform independent. And also architectures like CORBA and DCOM have also tried to achieve that independency (even though they have restrictions compared to Web Services, one of the main reasons for this is using Web as a transport/communication protocol) but they are still treated as some extensions on top of CSA because they are using CSA beneath. But if we compare Mainframes and CSA, even though I haven't seen manframe ages, I think it is clear that CSA does not use any architectural functionality of Mainframes. They are completely different.. But is SOA and CSA completely different ?
    I agree with all reasons why today business needs sth more agile, more flexible and it is becoming clearer day by day that SOA and Web Services provides this environment, BUT, I still cannot make it clear, WHY it is accepted as a transition from CSA and why it is not treated as a big development over CSA while using the main features of it.
    Any comments will be appreciated.
    Regards
    Ahmet Engin Tekin

    Good point..Actually those are the things clearly known but it becomes a bit confusing to build clear sentences when it comes to declare the differences. Anyway, here are my additions :
    - Mainframes were centralized systems which had their own hardware architecture as well. All processes/applications were running on 1 central DB/system and everyone in the company had to use the same functionality and interface.
    - In time, as a result of business demand, people needed different functionalities/applications regarding different business needs. This could either be done by extending the higly-costed big mainframe systems/softwares OR a new approach had to be developed in order to solve those problems. At this point, (thanks to IBM,Macintosh and Xerox) PC and ethernet concepts had emerged. That was a completely different hardware architecture which allowed less costly systems and also distributing the process load and/or applications to different systems in one landscape (app servers, intelligent clients - 2 tier, 3- tier arch.). Thus, while those were happening on harware side, new communication and programming models/languages emerged on software side. As a result, people started using different applications on different systems according to their needs and thus an efficient solution had been provided to the business need (described above).
    To criticise, this was really a big transition. Not only software concepts but also hardware concepts are also changed drastically. Actually, it is not wrong if we say, developments on the hardware side, allowed changes on the software side
    - What happened next ? Companies started using so many different applications by different vendors with different business logic and programming models (thanks to CSA). But in times, this has emerged the biggest problem of the CSA era : Integration.
    We all know the rest. "Web Services" concept emerged with SOA as well. So that, the boundaries between the systems began to disappear.
    So, is this a transition ? Well, yes it is.. The point that made it confusing (at least for me) is that this time there is no hardware transition (yet) but only a transition in software side. But I still insist that the IT transition during Mainframe->CSA was like a revolution (forget what you've left behind) but from CSA to SOA; it is more likely to be an evolution (the next best thing)
    Anyone have more comments ?
    Regards,
    Ahmet

  • Error deploying a composite to a clients server

    Hi,
    I'm having trouble deploying a composite to a clients server.
    I've defined the Configuration Plan to change all the references from our server to the clients server.
    The composite has some references to webservices deployed on the same server. I can test those webservices on the Enterprise Manager and they work.
    The error when I try to deploy is the following:
    Deploying on partition "default" of "/Farm_bpm_domain/bpm_domain/soa_server1" ...
    Deploying on "/Farm_bpm_domain/bpm_domain/soa_server1" failed!
    Error during deployment: Deployment Failed: Error occurred during deployment of component: ServiceTest2Process to service engine: implementation.bpmn for composite: ServiceTest2Composite: ORABPEL-05250
    Error deploying BPMN suitcase.
    error while attempting to deploy the BPMN component file "/oracle/product/fmw/11.1.1/bpm/user_projects/domains/bpm_domain/deployed-composites/ServiceTest2Composite_rev1.0/sca_ServiceTest2Composite_rev1.0/soa_68135a9a-c6b0-4982-99de-2eb366875b5d"; the exception reported is: java.lang.IllegalArgumentException: Conversation is not properly defined. There are not operation/process or external services defined
    This error contained an exception thrown by the underlying deployment module.
    Verify the exception trace in the log (with logging level set to debug mode).
    .The logs on the server (set to TRACE:32 (FINEST)) don't add anything to the error message.
    Anyone has had the same problem or has any ideia what might be the problem?
    Thanks in advance,
    Diogo Henriques

    Hi
    Can't offer much help but I just got exactly the same problem also. I just made a minor modification to a simple BPMN Test process. The change involved adding a Script Task and changing the assignment to the Output Argument of a Sub-Process. This change should not have caused any change to the service interface of the process. This was on a local Dev box.
    The process does call a Web Service. It was deploying/executing without error at last WLS boot a day ago, the Web Service is running fine and the process is building without error. There have been no other changes.
    This seems to be some kind of deployment versioning or stale caching related bug. I just undeployed the current version via EM (which actually reported a failure during undeployment but undeployed anyway!) and rebooted WLS and the deployment was then successful.
    See also Error deploying 2 processes in the same project BPM 11gR3 Project
    I suspect both of these are symptoms of the the same underlying problem which show up when there are repeated deployments of the same process after changes - regardless of whether you overwrite the existing version or start a new one.
    Regards
    Jim Nicolson

  • Mac mini server how many clients serve same time

    mac mini server[lion server] how many clients serve same time, the web server, suppose only traffic the web server?
    macs/PCs with server OSs designed for work as normal, but more mainly for left on, connected and serve clients on the internet eg web server, mail server? T/F

    Thanks for your help. I actually forgot that I posted this and when I saw the email telling me you sent a repsonse I then did another search (using a different phrase) and I found this:
    https://discussions.apple.com/thread/4554036?start=0&tstart=0
    I think that is saying that I can do what I am asking.

  • Client/Server hang up?

    I'm writing a basic client server program. I created an ArrayList to hold all the sockets of a connection so each client could, hopefully, eventually interact.
    Right now my client is a text field with a text area under it. A user types a command up top and then hits enter and sends that along to the server. However when i send in the message it seems to hang up and never sends back a reply. But what's really odd about it, is that if i close my server window and there by shutting it down the client then outputs exactly what i expected it to if it was working right. So im curious why there's this hangup in my code?
    Server:
    import java.awt.BorderLayout;
    import java.awt.Font;
    import java.io.IOException;
    import java.net.InetAddress;
    import java.net.ServerSocket;
    import java.net.Socket;
    import java.util.ArrayList;
    import javax.swing.JFrame;
    import javax.swing.JScrollPane;
    import javax.swing.JTextArea;
    public class Server extends JFrame{
              private JTextArea jta = new JTextArea();
              private static ArrayList<Socket> clients = new ArrayList<Socket>();
              public Server(){
                   getContentPane().setLayout(new BorderLayout());
                   getContentPane().add(new JScrollPane(jta), BorderLayout.CENTER);
                   jta.setFont( new Font( "Times", Font.BOLD, 20));
                   setSize(500, 300);
                   setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
                   setVisible(true);
                   try{
                        setTitle("Server: " + InetAddress.getLocalHost().getHostName());
                        int clientNo = 1;
                        ServerSocket serverSocket = new ServerSocket(0);
                        jta.append("Port: " + serverSocket.getLocalPort() + "\n");
                        while(true){
                             Socket socket = serverSocket.accept();
                             InetAddress inetAddress = socket.getInetAddress();
                             clients.add(socket);
                             World thread = new World(socket);
                             jta.append("Connected with client :" + clientNo + "\n");
                             thread.start();
                             clientNo++;
                   }catch(IOException ex){
                        System.err.println(ex);
              public static void main(String[] args){
                   new Server();
              public static ArrayList getClients(){
                   return clients;
         }World:
    import java.io.IOException;
    import java.io.PrintWriter;
    import java.net.InetAddress;
    import java.net.Socket;
    import java.util.ArrayList;
    import java.util.Scanner;
    public class World extends Thread {
         private Socket mySocket;
         private int myPort;
         private InetAddress myInetAddress;
         private String myHostName;
         private ArrayList<Socket> theClients;
         public World(Socket newSocket) {
              mySocket = newSocket;
              myPort = mySocket.getPort();
              myInetAddress = mySocket.getInetAddress();
              myHostName = myInetAddress.getHostName();
         public void run() {
              String test;
              Scanner input = null;
              PrintWriter output = null;
              try {
                   String fileName;
                   input = new Scanner(mySocket.getInputStream());
                   output = new PrintWriter(mySocket.getOutputStream(), true);
              }catch(IOException e){
              output.println("Please Enter Command");
              while((test = input.nextLine()) != null){
                   if(test.contains("get clients") ){
                        theClients = Server.getClients();
                        for(int i = 0; i < theClients.size(); i++){
                             output.println(theClients.get(i).getInetAddress().getHostName());
                        output.flush();
                   }else{
                        output.println("not sure");
                        output.flush();
    }Client:
    import java.awt.*;
    import java.awt.event.*;
    import java.io.*;
    import java.net.*;
    import java.util.Scanner;
    import javax.swing.*;
    public class Client extends JFrame implements ActionListener{
         private JTextField jtf;
         private JTextArea jta = new JTextArea();
         private PrintWriter output;
         private Scanner input;
         public Client(String host, int port){
              JPanel p1 = new JPanel();
              p1.setLayout(new BorderLayout());
              p1.add(jtf = new JTextField(10), BorderLayout.CENTER);
              jtf.setHorizontalAlignment(JTextField.RIGHT);
              jtf.setFont(new Font("Times", Font.BOLD, 20));
              jta.setFont(new Font("Times", Font.BOLD, 20));
              getContentPane().setLayout(new BorderLayout());
              getContentPane().add(p1, BorderLayout.NORTH);
              getContentPane().add(new JScrollPane(jta), BorderLayout.CENTER);
              jtf.addActionListener(this);
              setSize(500,300);
              setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
              setVisible(true);
              try{
                   setTitle("Client: " + InetAddress.getLocalHost().getHostName());
                   Socket socket = new Socket(host, port);
                   input = new Scanner(socket.getInputStream());
                   output = new PrintWriter(socket.getOutputStream(), true);
                   jta.append(input.nextLine() + "\n");
              }catch(IOException ex){
                   jta.append(ex.toString() + "\n");
         public void actionPerformed(ActionEvent e){
              String nextLine;
              String findFile = jtf.getText().trim();
              ((JTextField)(e.getSource())).setEditable(false);
              if ( e.getSource() instanceof JTextField){
                        jta.append("Getting file: \"" + findFile + "\" \n");
                        output.println(findFile);
                        output.flush();
                        while(input.hasNext()){
                             nextLine = input.nextLine();
                             jta.append(nextLine + "\n");
         public static void main(String[] args){
              int portSend;
              if (args.length != 2){
                   System.out.println("not Enough arguments");
                   System.exit(-1);
              portSend = Integer.parseInt(args[1]);
              new Client(args[0], portSend);
    }

    Don't run networking code in the constructor. Start a separate thread for the accept loop.

  • Thumbnail images in Forms6 client/server

    Hello,
    Some help would be greatly appreciated on this matter. I would like to be able to display a thumbnail image of a picture on the web in an oracle, NON-WEB enabled form.
    For example, when I open a form dealing with product details, I would like a piece of magic to retrieve a thumbnail image of the product from somewhere on the web, and display it on the form. Please note, in my situation it is not viable to store a scaled down version of the image int he database. The image must be located somewhere on the web.
    Some research into this has pointed me to OLE, but I can't seem to find anythng relating OLE to images in forms.
    Any ideas?
    - A Developer Scorned.

    Denis,
    I followed the instructions in the link you gave (how to put animated icons in forms in which you instructed how to use an activeX control to display images in client/server forms.
    I would like to thank you as it works beutifully, however there is one more question - Is there a way to get to image to scale or 'fit' to the size of the activeX control on the form
    - A Developer Scorned.

  • Running 9i Form in client server env

    I have instaled Oracle 9i DS on Win NT.
    I have created a form using 9i form.
    When i run the form it get a message "FRM-10142 - HTTP listener is not running on xyz machine at port 8888"
    This means that my form will run in a web based (thin client) env where as i want to create an application that is suppose to run in a client server env not on web browsers.
    Please guide me how can this me done.
    I am a new one to oracle DS. your help will be a good start for me
    Samir

    Forms 9i only runs on the web - it does not provide a way or running applications client server

  • Best practice for client-server(Socket) application

    I want to build a client-server application
    1) On startup.. client creates connection to Server and keeps reading data from server
    2) Server keeps on sending different messages
    3) Based on messages(Async) from server client view has to be changed
    I tried different cases ended up facing IllegalStateChangeException while updating GUI
    So what is the best way to do this?
    Please give a working example .
    Thanks,
    Vijay
    Edited by: 844427 on Jan 12, 2012 12:15 AM
    Edited by: 844427 on Jan 12, 2012 12:16 AM

    Hi EJP,
    Thanks for the suggestion ,
    Here is sample code :
    public class Lobby implements LobbyModelsChangeListener{
        Stage stage;
        ListView<String> listView;
        ObservableList ol;
         public Lobby(Stage primaryStage) {
            stage = primaryStage;
               ProxyServer.startReadFromServer();//Connects to Socket Server
             ProxyServer.addLobbyModelChangeListener(this);//So that any data from server is fetched to Lobby
            init();
        private void init() {
              ProxyServer.getLobbyList();//Send
            ol = FXCollections.observableArrayList(
              "Loading Data..."
            ol.addListener(new ListChangeListener(){
                @Override
                public void onChanged(Change change) {
                    listView.setItems(ol);
         Group root = new Group();
        stage.setScene(new Scene(root));
         listView = new ListView<String>();
        listView.maxWidth(stage.getWidth());
         listView.setItems(ol);
         listView.getSelectionModel().setSelectionMode(SelectionMode.SINGLE);
        istView.setOnMouseClicked(new EventHandler<MouseEvent>(){
                @Override
                public void handle(MouseEvent t) {
    //                ListView lv = (ListView) t.getSource();
                    new NewPage(stage);
         root.getChildren().add(listView);
         @Override
        public void updateLobby(LobbyListModel[] changes) {
    //        listView.getItems().clear();
            String[] ar = new String[changes.length];
            for(int i=0;i<changes.length;i++)
                if(changes!=null)
    System.out.println(changes[i].getName());
    ar[i] = changes[i].getName();
    ol.addAll(ar);
    ProxyServer.javaProxyServer
    //Implements runnable
    public void run()
         ......//code to read data from server
    //make array of LobbyListModel[] ltm based on data from server
         fireLobbyModelChangeEvent(ltm);
    void addLobbyModelChangeListener(LobbyModelsChangeListener aThis) {
    this.lobbyModelsChangeListener = aThis;
         private void fireLobbyModelChangeEvent(LobbyListModel[] changes) {
    LobbyModelsChangeListener listner
    = (LobbyModelsChangeListener) lobbyModelsChangeListener;
    listner.updateLobby(changes);
    Exception :
    java.lang.IllegalStateException: Not on FX application thread; currentThread = Thread-5
             at line         ol.addAll(ar);
    But ListView is getting updated with new data...so not sure if its right way to proceed...
    Thanks,
    Vijay                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                           

  • Help with installing a CHAT CLIENT/SERVER

    i cant seem to get my chatclient or chatserver to successfully connect to my server. even if i do a local host 127.0.0.1 thing it STILL says that it cannot connect.
    the server is a stand alone.
    is there a general place to install the compiled files?
    im SO frustrated right now.
    im writing a card game. it is done but now i need to implement the networking. so im starting with a simple chat server and i cant even get THAT to work.
    HELP.....

    I'm actually working on a card game (client/server if I can) as well, when I spotted this message. Card games work for me because they're simple, they're relatively fun and easy to figure out, and they aren't real-time or heavy on animation/sprites/hardware acceleration.
    http://vpoker.sourceforge.net/ is a java based card game that has some excellent examples of how to conceptualize a 'card' object and a 'deck' of cards.
    good luck, can try emailing me if you want to toss around ideas about our respective card games.

Maybe you are looking for