Can't get client and server to communicate

hiya
For some reason I can?t get server and client to exchange any messages ( server does receive a message from client only when I terminate the client process ).
At first I thought that firewall was somehow preventing the two from communicating, but then I ran some server-client app ( which I copied from the book I?m learning from) and it worked perfectly. So problem must be my code, but I don?t see anything wrong with it.
In the following code the client reads from console input and sends that to the server, which then echoes these data back to the client:
CLIENT SIDE:
import java.net.*;
import java.io.*;
import java.util.*;
public class Main {
    static Socket s;
    static String message, response;
    public static void main( String[] args ) {
              try{
                  send( 2000 );
              catch( Exception e { e.printStackTrace(); }
    static void send( int port ) throws IOException {
            InetAddress ia = InetAddress.getLocalHost();
            s = new Socket( ia, port );
            OutputStreamWriter ow = new OutputStreamWriter(
                    s.getOutputStream(), "UTF8" );
            BufferedWriter bw = new BufferedWriter ( ow ) ;
            InputStreamReader ir  = new InputStreamReader(
                    s.getInputStream(), "UTF8" );
            BufferedReader br = new BufferedReader ( ir );
            InputStreamReader console = new InputStreamReader (
                    System.in );
            BufferedReader readConsole = new BufferedReader (
                    console );
            do
                message = readConsole.readLine();
                bw.write( message );
                bw.flush();
                System.out.println( "waiting for a response" );
                response = br.readLine();
                System.out.print( " This was sent by server:" );
                System.out.println ( response );
            } while  (  !message.equals( "Stop" ) );
            s.close();
SERVER SIDE:
import java.net.*;
import java.io.*;
import java.util.*;
public class Main {
    public static void main( String[] args )  {
        try{
              Server.Init();
              Server.handleClient();
        catch( Exception e ){ e.printStackTrace(); }
class Server {
    static int port = 2000;
    static ServerSocket servs;
    static Socket s;
    static  void Init() throws IOException {
        servs = new ServerSocket( port );
    static void handleClient() throws IOException {
        do{
                 Server.connect();
        } while( true );
   static void connect() throws IOException {
          s = servs.accept();
          InputStream is = s.getInputStream();
          InputStreamReader isr = new InputStreamReader(is);
          BufferedReader bf = new BufferedReader(isr);
          OutputStream os   = s.getOutputStream();
          OutputStreamWriter osw = new OutputStreamWriter(os);
          BufferedWriter bfw  = new BufferedWriter(osw);
          String messages;
          System.out.println("reading first message");
          messages = bf.readLine();
          System.out.println("first message read");
          while ( ! messages.equals( "Stop" ) ) {
              bfw.write ( "message received" );
              bfw.flush();
              System.out.println( messages );
              messages = bf.readLine();
          s.close();
   } any help would be appreciated
thank you

I assumed that when client reads from console, the newline character is also copied into a string returned by readline(). I guess that applies only to read() methods, but not readline()?!
EDIT -I noticed that while now server does get the message and also sends it back to client, it doesn't itself display the message, even if I use flush(). Why is that?
          while ( ! messages.equals("Stop") ){
              bfw.write ( "message received" );
              bfw.newLine();
              bfw.flush();
              System.out.println( messages ); // this doesn't get written to the
                                                                console
              System.out.flush();
              messages = bf.readLine();
          }EDIT 2 - Nevermind. All works as it should!
thank you kindly for your help

Similar Messages

  • Async tcp client and server. How can I determine that the client or the server is no longer available?

    Hello. I would like to write async tcp client and server. I wrote this code but a have a problem, when I call the disconnect method on client or stop method on server. I can't identify that the client or the server is no longer connected.
    I thought I will get an exception if the client or the server is not available but this is not happening.
    private async void Process()
    try
    while (true)
    var data = await this.Receive();
    this.NewMessage.SafeInvoke(Encoding.ASCII.GetString(data));
    catch (Exception exception)
    How can I determine that the client or the server is no longer available?
    Server
    public class Server
    private readonly Dictionary<IPEndPoint, TcpClient> clients = new Dictionary<IPEndPoint, TcpClient>();
    private readonly List<CancellationTokenSource> cancellationTokens = new List<CancellationTokenSource>();
    private TcpListener tcpListener;
    private bool isStarted;
    public event Action<string> NewMessage;
    public async Task Start(int port)
    this.tcpListener = TcpListener.Create(port);
    this.tcpListener.Start();
    this.isStarted = true;
    while (this.isStarted)
    var tcpClient = await this.tcpListener.AcceptTcpClientAsync();
    var cts = new CancellationTokenSource();
    this.cancellationTokens.Add(cts);
    await Task.Factory.StartNew(() => this.Process(cts.Token, tcpClient), cts.Token, TaskCreationOptions.LongRunning, TaskScheduler.Default);
    public void Stop()
    this.isStarted = false;
    foreach (var cancellationTokenSource in this.cancellationTokens)
    cancellationTokenSource.Cancel();
    foreach (var tcpClient in this.clients.Values)
    tcpClient.GetStream().Close();
    tcpClient.Close();
    this.clients.Clear();
    public async Task SendMessage(string message, IPEndPoint endPoint)
    try
    var tcpClient = this.clients[endPoint];
    await this.Send(tcpClient.GetStream(), Encoding.ASCII.GetBytes(message));
    catch (Exception exception)
    private async Task Process(CancellationToken cancellationToken, TcpClient tcpClient)
    try
    var stream = tcpClient.GetStream();
    this.clients.Add((IPEndPoint)tcpClient.Client.RemoteEndPoint, tcpClient);
    while (!cancellationToken.IsCancellationRequested)
    var data = await this.Receive(stream);
    this.NewMessage.SafeInvoke(Encoding.ASCII.GetString(data));
    catch (Exception exception)
    private async Task Send(NetworkStream stream, byte[] buf)
    await stream.WriteAsync(BitConverter.GetBytes(buf.Length), 0, 4);
    await stream.WriteAsync(buf, 0, buf.Length);
    private async Task<byte[]> Receive(NetworkStream stream)
    var lengthBytes = new byte[4];
    await stream.ReadAsync(lengthBytes, 0, 4);
    var length = BitConverter.ToInt32(lengthBytes, 0);
    var buf = new byte[length];
    await stream.ReadAsync(buf, 0, buf.Length);
    return buf;
    Client
    public class Client
    private TcpClient tcpClient;
    private NetworkStream stream;
    public event Action<string> NewMessage;
    public async void Connect(string host, int port)
    try
    this.tcpClient = new TcpClient();
    await this.tcpClient.ConnectAsync(host, port);
    this.stream = this.tcpClient.GetStream();
    this.Process();
    catch (Exception exception)
    public void Disconnect()
    try
    this.stream.Close();
    this.tcpClient.Close();
    catch (Exception exception)
    public async void SendMessage(string message)
    try
    await this.Send(Encoding.ASCII.GetBytes(message));
    catch (Exception exception)
    private async void Process()
    try
    while (true)
    var data = await this.Receive();
    this.NewMessage.SafeInvoke(Encoding.ASCII.GetString(data));
    catch (Exception exception)
    private async Task Send(byte[] buf)
    await this.stream.WriteAsync(BitConverter.GetBytes(buf.Length), 0, 4);
    await this.stream.WriteAsync(buf, 0, buf.Length);
    private async Task<byte[]> Receive()
    var lengthBytes = new byte[4];
    await this.stream.ReadAsync(lengthBytes, 0, 4);
    var length = BitConverter.ToInt32(lengthBytes, 0);
    var buf = new byte[length];
    await this.stream.ReadAsync(buf, 0, buf.Length);
    return buf;

    Hi,
    Have you debug these two applications? Does it go into the catch exception block when you close the client or the server?
    According to my test, it will throw an exception when the client or the server is closed, just log the exception message in the catch block and then you'll get it:
    private async void Process()
    try
    while (true)
    var data = await this.Receive();
    this.NewMessage.Invoke(Encoding.ASCII.GetString(data));
    catch (Exception exception)
    Console.WriteLine(exception.Message);
    Unable to read data from the transport connection: An existing   connection was forcibly closed by the remote host.
    By the way, I don't know what the SafeInvoke method is, it may be an extension method, right? I used Invoke instead to test it.
    We are trying to better understand customer views on social support experience, so your participation in this interview project would be greatly appreciated if you have time. Thanks for helping make community forums a great place.
    Click
    HERE to participate the survey.

  • Reg : How can I get  Username and Password in FTP Server in HANA

    Hi All,
      Any one can you please guide me....How can i get username and Password of FTP Server in SAP HANA?
    Regards,
    Arjun

    Hi Arjun,
    Are you looking for external authentication(External ID option) in HANA Studio instead of logging by entering HANA User and Pwd(which is internal)?
    You can look for the following Security guide which will give you some insight on this.
    http://help.sap.com/hana/hana1_sec_en.pdf
    Rgds,
    Murali

  • JSSE  Client and server communication problem .err:untrusted server cert

    Hai all,
    I am trying to communicate JSSE client and server.
    I have created root.cert(CA),root.key,server.cert,server.key , client.cert and client.key. All these certificates are created using openssl.
    I have placed root.cert in default keystore cacerts.
    I have created a keystores(server & client) name mykeystore.
    I have placed root.cert and client.cert in the client keystore.
    I have placed root.cert and server.cert in the server keystore.
    But during the run time i am getting javax.net.ssl.SSLException: untrusted server cert chain.
    please suggest the modifications needs to be done to fix the error.
    please tell me In the client keystore and in the server keystore....what certificates we need to put?
    whether my approach as said above is correct or not?
    In java code how to specify this particular certificate we are referring?
    I have coded in this way ....
    SSLContext ctx;
    KeyManagerFactory kmf;
    KeyStore ks;
    char[] prasad = "prasad".toCharArray();
    ctx = SSLContext.getInstance("SSLv3");
    kmf = KeyManagerFactory.getInstance("SunX509");
    ks = KeyStore.getInstance("jks");
    ks.load(new FileInputStream("mykeystore"), prasad);
    kmf.init(ks, prasad);
    ctx.init(kmf.getKeyManagers(), null, null);
    factory = ctx.getSocketFactory();
    But my doubt is we are specifying only keystore name with that how it will check root.cert(ca) and client.cert and server.cert?
    Is there any modifications need in my code?
    Please tell me some way ...
    Thanks ,
    Prasad.

    Hi prasad,
    There will be a problem with the certificates being received from thr remote server or client. Check that your trust store contains the certificate of the remote machine or the CA that signed it and that the certificate has not expired.
    Also be sure that both machines are using the latest version of the JSSE.
    Hope this will help you.
    Regards,
    Anil.
    Technical Support Engineer.

  • Socket communication between client and server

    Hi all,
    I am doing an assignment for communication between java client and java server using sockets. This communication is in the form of XML documents. I am facing a problem in this communication.
    Actually at Server side I'm creating an XML document(Document type object) using DocumentBuilderFactory in javax.xml.parsers package and transforming this Document into a stream using StreamResult.
    My code is :
    Transformer xmlTransformer = TransformerFactory.newInstance().newTransformer();
    StreamResult xmlString = new StreamResult(currentClientHandler.getSocketOutputStream());
    DOMSource xmlDocSource = new DOMSource(xmlDocument); // xmlDocument is Document type reference
    xmlTransformer.transform(xmlDocSource, xmlString);
    so, this xmlString(i.e. StreamResult) is passed directly into the output stream. Here I need to close() output stream after transform() call to help SAX parser to know about end of stream.
    Now at Client side, I am parsing this stream using SAX parser. It parses this correctly. But when sending some another data back to Server when client opens output stream, it given Socket closed exception. I know that closing input or output stream closes socket. But in my problem, I have to send data in streams and not by using files or byte[] etc.
    So what is nearest solution to problem ??
    Plz help me. Any kind of help will be greatly appreciated.

    hi
    thanks for ur reply.
    I didnt get any error msg while getting the back the datas.
    Actually i divided my application into two parts.
    My application will act as both server and client.
    server ll get the browser request and send to the client and the client will send that data to the c++ server.
    Im able to do that.and unable to get the data from server.
    Didnt get any error.
    can u tell me how to make an application to act as both client and server.
    I think im wrong in that part.
    thanks a lot

  • UDP Client and Server

    I am trying to run a UDP Client and Server by running the server first and then the client. But when I try to do that I get the message java.lang.NoClassDefFoundError: UDPServer and java.lang.NoClassDefFoundError: UDPClient. I have included the code below. Can you please help. Thank you.
    UDPClient.java:
    import java.io.*;
    import java.net.*;
    import java.util.*;
    public class UDPClient{
        public static void main(String[] args) throws IOException{
          Date d=new Date();
          long time1, time2, ETE, sumETE, maxETE, avgETE;
          if(args.length!=1){
              System.out.println("type java UDPClient <hostname>");
              return;
          time1=d.getTime();
          DatagramSocket s=new DatagramSocket();
          String st=new String("dldfjsdkjf");
          byte[] buf=new byte[256];
          buf=st.getBytes();
          InetAddress address=InetAddress.getByName(args[0]);
          DatagramPacket p = new DatagramPacket(buf, buf.length, address, 8777);
          s.send(p);
          p=new DatagramPacket(buf, buf.length, address, 8777);
          s.receive(p);
          time2=d.getTime();
          ETE=(time2-time1)/2;
          s.close();
    UDPServer.java:
    import java.io.*;
    import java.net.*;
    import java.util.*;
    import java.lang.*;
    public class UDPServer{
      public static void main(String[] args){
        try{
          UDPServerThread ust = new UDPServerThread();
          ust.start();
        catch(IOException e){}
    UDPServerThread.java:
    import java.io.*;
    import java.net.*;
    import java.util.*;
    import java.lang.*;
    public class UDPServerThread extends Thread{
      DatagramSocket s=null;
      BufferedReader br=null;
      PrintWriter pw=null;
      public UDPServerThread() throws IOException{
        this("UDPServer");
      public UDPServerThread(String name) throws IOException{
        super(name);
        s=new DatagramSocket(8777);
      public void run(){
          char[] ca=new char[10];
        //while(true){
          try{
              byte[] buf = new byte[256];
              DatagramPacket p = new DatagramPacket(buf, buf.length);
              s.receive(p);
              String st=new String(p.getData());
              for(int i=0; i<10; i++){
                  ca=st.charAt(i);
    buf=st.getBytes();
    InetAddress ad = p.getAddress();
    int port = p.getPort();
    p = new DatagramPacket(buf, buf.length, ad, port);
    s.send(p);
    catch(IOException e){
    System.err.println("Failed to run the server");
    System.exit(-1);
    s.close();

    this has nothing to do with your code, but how you are running it. It is a classpath problem.
    You should go to the directory where the UDPClient.class is, and type
    java -classpath . UDPClient
    similarly for the UDPServer

  • JSSE client and server

    Hai all,
    I am trying to communicate jsse client and server.
    It is showing socket closed error.
    when will we get java.net.SocketException: Socket closed?
    please tell me way to sort this problem
    Thanks,
    Prasad.

    Hi prasad,
    There are two reasons for this error to occur
    java.net.SocketException: Socket closed
    (i)First is that the provider is not registered properly. Check your java.security files and make sure that you have created an entry for
    com.sun.net.ssl.internal.ssl.Provider.
    Then make sure that there are no extra java.security files on your hard drive that are being used by your runtime configure your providers. If there make sure to add the providers to them also.
    (ii) Secondly there may be problem with your keystore. Make sure that you are providing the proper file and password for your keystore.
    If you are using SSL socket server then check the following code:
    SSLServerSocketFactory ssf = (SSLServerSocketFactory )SSLServerSocketFactory.getDefault();
    ServerSocket ss = ssf.createServerSocket(PORT);
    Socket s = ss.accept();
    If you are using regular sockets, perform the following:
    ServerSocket ss = new ServerSocket(PORT);
    Hope this will help you.
    Regards,
    Anil.
    Technical Support Engineer.

  • Strange problem with SQLPLUS when client and server on the same box

    Hi,
    I have the problem with SQLPLUS when clinet and server on the same machine.
    With client and server on the same machine i am running the command
    sqlplus -l username/password@connect_identifier as SYSDBA.
    With this command, even if you pass in wrong username or wrong password or both as wrong you can able to connect to database and execute queries.
    Once Connect_identifier is correct and trying to log in as SYSDBA ,sqlplus will log in to DB with any username and password.
    How to get rid of this behaviour. Is there any way to do this.
    I am running this command by creating a process in C#
    Edited by: user11000236 on Jun 16, 2009 10:31 AM

    user11000236 wrote:
    Thanks for the info.
    How does Oracle/SQLPLUS allows any username or password to log in to DB with SYSDBA Privillages? What is the concept behind this.?
    This is explainted in the above mentioned link:
    Operating system authentication takes precedence over password file authentication. If you meet the requirements for operating system authentication, then even if you use a password file, you will be authenticated by operating system authentication.

  • Where can I get Client for Win95?

    Hi.
    Maybe who know where can I get Client for Win95?
    I use client from Oracle73. But It'doesn't work properly.
    Thnak You in advise.
    null

    Vincent GRENET (guest) wrote:
    : Andrey (guest) wrote:
    : : Vincent GRENET (guest) wrote:
    : : : Andrey (guest) wrote:
    : : : : Hi.
    : : : : Maybe who know where can I get Client for Win95?
    : : : : I use client from Oracle73. But It'doesn't work properly.
    : : : : Thnak You in advise.
    : : : The ODBC driver is available on this site, but Net8 Client
    : and
    : : : Installer is needed (according to documentation), and I
    : can't
    : : : figure out where to find this! Any idea ?
    : : Hi.
    : : People say that using client from Ora73 (for win) is more
    than
    : : enougth.
    : : & I'm doing in such way... It's look to be Ok.
    : : Yours ANdrey
    : My problem is I don't have the client from Ora73. But I have
    the
    : answer from web-support:
    : if you want the client, download the server. (265 Mb !!)
    : It's hard to download slices of 20 Mb without being
    : disconnected, and the server does not support resuming!
    : VG
    The ftp site supports broken dl's. ftp.oracle.com/pub/www/
    null

  • Communication between two jvm (client and server)

    Hi ,
       I want to access the UME service of the SAP J2EE Container using a stanalone client application.
    So the client would be running on remote JVM.
    Here we use the JNDI service to communicate between the client and server.
    p.put(Context.INITIAL_CONTEXT_FACTORY,"com.sap.engine.services.jndi.InitialContextFactoryImpl");
                        p.put(Context.PROVIDER_URL, providerURL.trim());
                        p.put(Context.SECURITY_PRINCIPAL, securityPrinciple.trim());
                        p.put(Context.SECURITY_CREDENTIALS, securityCredentials.trim());
                        Context ctx = (Context) new InitialContext(p);
                        Object objRef = ctx.lookup(ejbName.trim());
    I want to know that is the communication between the client and server secured in this scenario
    Best Regards
    Manoj

    Okay, the client and server VMs are different implementations of the Hotspot engine. Hotspot basically takes the Java bytecode from your .class files and turns it into native machine instructions at runtime. (The optimizations are actually much more complex than that, but that's the basic concept.)
    The client VM is so named because it's designed to be used for GUI-type applications interacting with the user. It is designed to have a quicker startup and smaller memory footprint.
    The server VM uses more memory and is typically slower at starting up than the client VM, but can often perform ridiculously fast. This of course depends completely on the particular code being run, and you should probably profile and see which VM works better for your application.
    Some interesting optimizations are performed by the 1.4.1 server VM, such as: removal of array-bounds checks (when it determines that the index can't become out of bounds), inlining of methods, and more.
    Here is a link to more info if you're interested:
    http://java.sun.com/products/hotspot/docs/whitepaper/Java_HotSpot_WP_Final_4_30_01.html

  • Connection between SDM client and server is broken

    Dear All,
    First of all this is what I have
    -NW04 SPS 17
    -NWDS Version: 7.0.09 Build id: 200608262203
    -using VPN connection
    -telnet on port 57018 is succesfull
    I can login to SDM server (from NWDS and from SDM GUI) I can see the state of SDM(green light), restart it, can navigate through tabs in GUI, but every time I am trying to deploy an ear i have this error:
    Deployment exception : Filetransfer failed: Error received from server: Connection between SDM client and server is broken
    Inner exception was :
    Filetransfer failed: Error received from server: Connection between SDM client and server is broken
    I have already read a lot of topics,blogs,notes but didn't find the solution.
    Can anybody help me?
    Best Regards

    Having same issue. Nothing helped so far... Using NWDS 7.0 SP18.
    I have turned SDM tracing on and this is what I see on client side after sending first data package:
    com.sap.sdm.is.cs.cmd.client.impl.CmdClientImpl: debug "20120224140253 0280/17 Client: finished sending string part"
    com.sap.sdm.is.cs.cmd.client.impl.CmdClientImpl: debug "20120224140253 0280/0 Client: receive String part from Server"
    com.sap.sdm.is.cs.cmd.client.impl.CmdClientImpl.receiveFromServer(NetComm ..): Entering method
    com.sap.bc.cts.tp.net.NetComm.receive(): Entering method
    com.sap.bc.cts.tp.net.NetComm: debug "Method "receive(char[])" could not read all requested bytes. There are still 12 bytes to read"
    com.sap.bc.cts.tp.net.NetComm: debug "Caught IOException during read of header bytes (-1,          43):Connection reset"
    com.sap.bc.cts.tp.net.NetComm: debug "  throwing IOException(net.id_000001)"
    com.sap.bc.cts.tp.net.NetComm.receive(): Exiting method
    com.sap.sdm.is.cs.cmd.client.impl.CmdClientImpl: Exiting method
    com.sap.sdm.is.cs.cmd.client.impl.CmdClientImpl: debug "20120224140253 0281/1 Client: connection was broken"
    com.sap.sdm.is.cs.cmd.client.impl.CmdClientImpl: Exiting method
    com.sap.sdm.is.cs.cmd.client.impl.CmdClientImpl: debug "20120224140253 0281/0 Client: finshed sendAndReceive"
    com.sap.sdm.is.cs.cmd.client.impl.CmdClientImpl: Exiting method
    My connection on server is still active so I have to restart SDM server to reset and try it again.
    Anyone have idea whats happening?
    Edited by: skyrma on Feb 24, 2012 2:46 PM
    Edited by: skyrma on Feb 24, 2012 2:47 PM
    Edited by: skyrma on Feb 24, 2012 2:47 PM

  • Client and Server in one process

    Hi all,
    I am trying to create a process which can act as both Client and Server.
    How can I do this?
    Thanks!

    AH. That's a better definition or explanation. Thanks.
    This smells of a single process with multiple threads, each thread handling the basic needs of your requirements. In other words, have a thread deal with making one or more client type connections (use a main thread - the client controller - to spawn client-connection threads. This assumes you need multiplicity in your client-connection model.
    Then make another thread - the server controller - to handle inbound connections, spawning a new thread for each inbound connection. Your main thread, the one that contains your main method, can watch everything that's going on and log or report what's going on in your client and server threads.
    Going into specifics would be a lot to do here. Maybe someone is up for the challenge. Of course, this being a "New to Java Technology" forum, these concepts may be a bit beyond your skillset.
    This is not the only way to go about solving your problem, but it's the only way I can think of at the moment given your requirements.
    Hope this helps some.

  • Communication between client and server

    I am using sockets for communication between the client and the server. is there any other way that i can use for communication between the client and server???

    Plenty of ways: JMS, SOAP, RMI, a RESTful API, writing-files-to-a-shared-directory-on-the-disk, Sneakernet, ...
    Some of them use sockets (or better TCP/IP) as the underlying protocol.
    But to give you a good answer, you would have to tell us why you want a different way. I hope you're not searching for a different way just for the sake of being different.

  • How can I get client IP address in portlet (servlet) ?

    How can I get client IP address in portlet (servlet) ?
    request.getRemoteAddr() return server IP.
    May be I must use Portal API, which extend Servlet classes, but I can't find this.
    Can any help me?

    Hi,
    Following query can help you to get the Client IP Address.
    select sys_context('userenv','ip_address') from dual;
    Thanks,

  • To_char displays different results on sql client and server

    Hi,
    I am executing the below query on my database with 8.1.7.4 version:
    SQL> select to_char(to_date('20-OCT-07'),'D') from dual;
    The following result is displayed:
    T
    7
    When the same query is being run through sqlplus client(9.2.0.3) connecting to the same database, following result is being displayed:
    SQL> select to_char(to_date('20-OCT-07'),'D') from dual;
    T
    6
    Could anyone please explain me why is this difference and what parameter setting needs to be made to get the same result.
    Thanks in advance,
    Vishwanath

    Or from the territory part of NLS_LANG OS variable :
    oracle@xxx:/home/oracle# echo $NLS_LANG
    AMERICAN_AMERICA.UTF8
    oracle@xxx:/home/oracle# sqlplus '/ as sysdba'
    SQL*Plus: Release 9.2.0.8.0 - Production on Mon Oct 22 10:44:59 2007
    Copyright (c) 1982, 2002, Oracle Corporation.  All rights reserved.
    Connected to:
    Oracle9i Enterprise Edition Release 9.2.0.8.0 - 64bit Production
    With the Partitioning, OLAP and Oracle Data Mining options
    JServer Release 9.2.0.8.0 - Production
    SQL> select to_char(to_date('20-OCT-07'),'D') from dual;
    T
    7
    SQL> quit
    Disconnected from Oracle9i Enterprise Edition Release 9.2.0.8.0 - 64bit Production
    With the Partitioning, OLAP and Oracle Data Mining options
    JServer Release 9.2.0.8.0 - Production
    oracle@xxx:/home/oracle# export NLS_LANG=AMERICAN_FRANCE.UTF8
    oracle@xxx:/home/oracle# sqlplus '/ as sysdba'
    SQL*Plus: Release 9.2.0.8.0 - Production on Mon Oct 22 10:45:38 2007
    Copyright (c) 1982, 2002, Oracle Corporation.  All rights reserved.
    Connected to:
    Oracle9i Enterprise Edition Release 9.2.0.8.0 - 64bit Production
    With the Partitioning, OLAP and Oracle Data Mining options
    JServer Release 9.2.0.8.0 - Production
    SQL> select to_char(to_date('20-OCT-07'),'D') from dual;
    T
    6
    SQL>Check it on both sites (client and server).
    Nicolas.

Maybe you are looking for