Can you help? -- Server don't sends messages.

I have this program, a server to transmit text files (I mean: it's suppose to that, that doesen't means that it does it!), but when the server should send messages nothing happens!
I cannot understand why, can you?
Thanks.
Here is the program:
import java.io.*;
import java.net.*;
*Commands:
*000-Do Nothing (File Transfer)
*101<name>-Transfer file with that name
*102<name>-Transfer array with that name
*777-Error
*999-exit
*System File:
*Adimistrator password
*Max num of connections
*Number of accounts
*Accounts...
public class DataTransferServer{
    public static server Server;
    public static PrintWriter log;
    private static void startlog(){
        try{
            log = new PrintWriter(new FileWriter("ServerLog.txt"));
            log.println(System.currentTimeMillis()+": "+"Log started.");
        }catch(Exception e){
            System.out.println("Could not start log");
    public static void sendDatabase(String path){
        try{
            TextReader input = new TextReader(new FileReader(path));
        }catch(Exception e){
    public static void SERVER(int port){
        //while(true){
        try{
            Server.makeserver(port);
            //log.println(System.currentTimeMillis()+": "+"Server connected.");
            controler Controler = new controler();
            //log.println(System.currentTimeMillis()+": "+"Going to start controler...");
            Controler.controler(Server.returnConnection());
            System.out.println("Connection accepted");
        }catch(Exception e){
            System.out.println("Error");
class controler extends java.lang.Thread{
    private Socket socket;
    public static PrintWriter log;
    private static long startlog = System.currentTimeMillis();
    private static void startlog(){
        try{
            log = new PrintWriter(new FileWriter("ServerThreadLog.txt"));
            System.out.println(System.currentTimeMillis()-startlog+": "+"Log started.");
        }catch(Exception e){
            System.out.println("Could not start log");
    public void controler(Socket Socket){
        startlog();
        System.out.println(System.currentTimeMillis()-startlog+": "+"Log started.");
        socket = Socket;
        start();
    public void run(){
        try{
            log.println(System.currentTimeMillis()-startlog+": "+".");
            PrintWriter out = new PrintWriter(socket.getOutputStream());
            TextReader in = new TextReader(socket.getInputStream());
            boolean exit = false;
            int permission = 0;
            while(!exit){
                System.out.println(System.currentTimeMillis()-startlog+": "+"Sending greetings message.");
                out.println("000Hello"); //At least here it should transmit anything!
                System.out.println(System.currentTimeMillis()-startlog+": "+"Getting command.");
                String command = in.getln();
                System.out.println(System.currentTimeMillis()-startlog+": "+"Got command: "+command+".");
                System.out.println(System.currentTimeMillis()-startlog+": "+"Got Action: "+getAction(command)+".");
                int ToDo = getAction(command);
                switch(ToDo){
                    case 999:
                        System.out.println(System.currentTimeMillis()-startlog+": "+"In case 999.");
                        exit = true;
                        break;
                    case 102:
                        try{
                            System.out.println(System.currentTimeMillis()-startlog+": "+"In case 102.");
                            String[] args = getArgs(command);
                            System.out.println(System.currentTimeMillis()-startlog+": "+"Args1: "+args[0]);
                            TextReader incoming = new TextReader(new FileReader(args[0]));
                            int length = 0;
                            while(!incoming.eof()){
                                incoming.getln();
                                length++;
                            System.out.println(System.currentTimeMillis()-startlog+": "+"Lenght: "+length);
                            incoming = new TextReader(new FileReader(args[0]));
                            for(int count=0; count<=length-1; count++){
                                String temp = incoming.getln();
                                out.println("000"+temp);
                                System.out.println("Send>000"+temp);
                            break;
                        }catch(Exception e){
                            System.out.println(System.currentTimeMillis()-startlog+": "+"102: Exception Occurred: "+e.toString());
        }catch(Exception e){
            System.out.println(System.currentTimeMillis()-startlog+": "+"Exception Occurred: "+e.toString());
        System.out.println(System.currentTimeMillis()-startlog+": "+"999: Exit.");
    private static String[] getArgs(String command){
        System.out.println(System.currentTimeMillis()-startlog+": "+"In getArgs.");
        command = command.substring(3, command.length());
        System.out.println(System.currentTimeMillis()-startlog+": "+"The command: "+command);
        String[] args = new String[0];
        int last = 0;
        System.out.println(System.currentTimeMillis()-startlog+": "+"Command length: "+command.length());
        boolean exit = false;
        int end = command.length();
        int count = 0;
        while(count<end){
            System.out.println(System.currentTimeMillis()-startlog+": "+"(count="+count+").");
            if(command.charAt(count)==',' || command.charAt(count)==';'){
                System.out.println(System.currentTimeMillis()-startlog+": "+"Found ',' or ';'.");
                args = addColum(args);
                args[args.length-1] = command.substring(last, count);
                System.out.println(System.currentTimeMillis()-startlog+": "+"Found arg: "+args[args.length-1]);
                last = count+1;
            count++;
        System.out.println(System.currentTimeMillis()-startlog+": "+"Returning args.");
        return args;
    private static String[] addColum(String[] oldArray){
        System.out.println(System.currentTimeMillis()-startlog+": "+"In addColum.");
        String[] newArray = new String[oldArray.length+1];
        for(int counta = 0; counta<=oldArray.length-1; counta++){
            newArray[counta] = oldArray[counta];
        return newArray;
    private static int getAction(String command){
        return Integer.parseInt(command.substring(0, 3));
}The problem is not of the client (I hope!), because I tested it.
Thanks for your help.

OK, I got the anser:
Sould be:
PrintWriter out =new PrintWriter(new BufferedWriter(new OutputStreamWriter(socket.getOutputStream())),true);Instead of:
PrintWriter out = new PrintWriter(socket.getOutputStream());

Similar Messages

  • Can you help with this serious error message?

    I have Premiere Elements 8.  I tried to open some .prel that I have made and now I get this error message:   Projects created with Adobe Premiere Pro and Adobe Premiere Elements are not compatible.  Please use the appropriate application to open this project.  What gives??  Also, as usual, Premiere Elements 8 crashes after I have accomplished one lousy thing, so I have to constantly open project and save.  Now I can't even open a project.
    Thanks for any help you can give me.

    Holy cow! Something is seriously wrong here, lilthea!
    What model of camcorder is your video coming from and what format and resolution is it?
    What project settings did you select when you set up your project? (You can see them under Edit/Project Settings.)
    Version 8 was not the best version of the program ever produced. In fact, it was one of the worst, when first released. But if you downloaded the update (from Help/Check for Updates) and the rest of your system is stable, you should at least be able to edit video from a miniDV, HDV or even AVCHD camcorder.
    If you truly can't do ANYTHING without it crashing though, there's something much, much deeper going on that a bug in your program or its set-up. (This is why I need you to be as specific as you can about things!) If things are really that unstable, it could indicate malware or viruses or possible corruption of the operating system.
    I sometimes recommend a program that I use every week but that some people object to because it's Chinese software and has been accused of stealing virus definitions from other software companies. But it's got an easy interface. Just select Deep Care, click the go button and then select the option to clean. In my opinion, it makes your operating system as good as new. But there are some people who disagree, so that's my personal recommendation only.
    Download the free version from here:
    http://www.iobit.com/advancedsystemcareper.html
    What you're dealing with could be problems with your source video -- since I don't have enough information to say either way. But, assuming your video came from a miniDV, HDV or AVCHD camcorder and that you've properly set up your project to those specs, a tune-up using Advanced System Care might be worth considering.

  • Since downloading IOS6 I cannot receive or send emails, can you help

    Since downloading IOS6 I cannot receive or send emails, can you help

    I've done that. But the settings "mail, contacts, calendar" are still disabled. For example, if I want to add a new mail account, I can not do it. Because the option "add account" is as if it's turned off, disabled, as well as my other accounts above this ...
    The rest of the IOS6 everything worked out, but with the native Mail app is complicated ...

  • HT201320 I cannot send e-mail, the message comes back. "Copy placed in Outbox, address was rejected by server" I think it may be real simple, can you help?

    Can you help with my ipad problem?

    Most, if not all ISPs and email account providers have similar limits to the following for personal/non-business email accounts as part of an overall effort to eliminate or reduce bulk spam emanating from the ISP's or email account provider's domain.
    Any ISP or email account provider that doesn't impose similar limits is helping to contribute to the amount of spam that gets circulated.
    .Mac has several safeguards in place to ensure that only .Mac members send messages with the Mac.com outgoing mail server.
    Among them are reasonable limitations on:
    The number of messages that can be sent each day (200 messages)
    The number of recipients that can be sent to each day (400 recipients)
    The number of recipients a message can be addressed to at one time (100 recipients)
    There is also a 10 MB maximum size for messages sent or received using the .Mac mail system.

  • Hi Guys, Im trying to send a 80pages IPhoto book to the store but the uploading fails, I tried several times and always a message "an error occurred" without clarification, can you help me?

    Hi Guys, Im trying to send a 80pages IPhoto book to the store but the uploading fails, I tried several times and always a message "an error occurred" without clarification, can you help me?
    Is there any size limit? or a limit of time to upload? (as it takes more than one hour!!!)

    Preview the book -
    Before ordering your book preview it using this method - http://support.apple.com/kb/HT1040 - and save the resulting PDF for reference - the delivered book will match it.
    if it is good boot into safe mode, preview again (only limited fonts are loaded in safe mode) and upload
    LN

  • Hello! I cannot get my gmail from my iPad icon any more, saying the mail server is not responding. I can still get my gmail though from google search! Can you help??

    Hi! The Mail icon on my iPad is no longer responding!  A message comes up saying - ' Cannot get mail...the mail server imap.gmail.com is not responding.  Verify that you have entered the correct account info in Mail settings'.  I have tried this and everything is correct!  It is puzzling because I can still get my gmail through Google search!  Can you help?? Thanks

    iOS: Unable to send or receive email
    http://support.apple.com/kb/TS3899
    Can’t Send Emails on iPad – Troubleshooting Steps
    http://ipadhelp.com/ipad-help/ipad-cant-send-emails-troubleshooting-steps/
    Setting up and troubleshooting Mail
    http://www.apple.com/support/ipad/assistant/mail/
    Server does not allow relaying email error, fix
    http://appletoolbox.com/2012/01/server-does-not-allow-relaying-email-error-fix/
    Why Does My iPad Say "Cannot Connect to Server"?
    http://www.ehow.co.uk/info_8693415_ipad-say-cannot-connect-server.html
    iOS: 'Mailbox Locked', account is in use on another device, or prompt to re-enter POP3 password
    http://support.apple.com/kb/ts2621
    iPad Mail
    http://www.apple.com/support/ipad/mail/
    Configuration problems with IMAP e-mail on iOS with a non-standard SSL port.
    http://colinrobbins.me/2013/02/09/configuration-problems-with-imap-e-mail-on-ios -with-a-non-standard-ssl-port/
    Try this first - Reset the iPad by holding down on the Sleep and Home buttons at the same time for about 10-15 seconds until the Apple Logo appears - ignore the red slider - let go of the buttons. (This is equivalent to rebooting your computer.)
    Or this - Delete the account in Mail and then set it up again. Settings->Mail, Contacts, Calendars -> Accounts   Tap on the Account, then on the red button that says Remove Account.
     Cheers, Tom

  • When I first load Firefox, it comes up with an error message about "script". Can you help me?

    <blockquote>Locking duplicate thread.<br>
    Please continue here: [[/questions/846741]]</blockquote>
    I just double click on the Icon, and it seems it takes forever to load.
    After this action, an error message comes up with a statement that it is trying to read some sort of script. Next it tells me to press continue to go ahead. At this time, it loads up normally. Can you help?

    This issue can be caused by an extension that isn't working properly.
    Start Firefox in <u>[[Safe Mode]]</u> to check if one of the extensions is causing the problem (switch to the DEFAULT theme: Firefox (Tools) > Add-ons > Appearance/Themes).
    *Don't make any changes on the Safe mode start window.
    *https://support.mozilla.com/kb/Safe+Mode
    *https://support.mozilla.com/kb/Troubleshooting+extensions+and+themes

  • I'm having a problem sending tex it keeps coming back not delivered on my I phone 4 can you help

    Can you help I can't send Tex's on my I phone 4 it's been the last couple days now I can receive them but when I reply they come back undelivered can you help

    Check Settings > Messages > Send as SMS = "On"

  • Can't send emails.  Can you help pls? Thanks.

    Hi, my Mac Book Pro won't let me send emails.  It says: Outgoing mail server (SMTP): Gmail Offline.  Can you help pls? Thanks.

    Help.  I have the same problem.  I can receive email but can not send email from my MacBook Pro running OS X 10.9.4.
    I have been reading posts about this issue until my eyes are rectangular.
    I have tried the following:
    1. Removing the passwords from the keychain.
    2. Trying the various ports (default set, custom 25 alone, custom 465 alone, custom 587 alone)
    3. Unticking the Use SSL box.   Interesting note, it sometimes self-ticks this box.
    4. Supplying full email name in the userid box.  Interesting note, it sometimes self-corrects to just the plain userid prefix.
    5. Running repair disk permissions
    6. Turning offline all mailbox accounts and then turning then back online.
    7. Rebooting numerous times
    8. Force Quit of Mail and numerous normal quits and restarts.
    9. All software updates have been installed.
    10.  I may have forgotten some of the more bizarre things I have tried but I have not got to the point of deleting the entire account (and all of its 3 years of emails). 
    I have a sister MacBook Pro (same operating system, larger screen, same ISP, same email provider, same power source, etc.) sitting right next to this one and it is working fine - mail comes in and mail goes out. It is on the same network and I have dutifully copied all of the parameters and this still does not solve the issue.  Surely, there is more witchcraft out there that I can try?   New to this "posting" process.  Not even sure how to get back to see if anyone has any further suggestions.  Thanks to all those who have tried to provide suggestions.  Much appreciated but I am still stuck with webmail!  Arghhhh. Ron

  • After i installed ios 7 in my iPhone 4s and I got problem to login into my icloud account. There is a message appear and said  "the operation couldn't be completed (com.apple.appleaccount error 403)" can you help me ? how can i fix this problem ? iPhone 4

    After i installed ios 7 in my iPhone 4s and I got problem to login into my icloud account.
    There is a message appear and said  "the operation couldn't be completed (com.apple.appleaccount error 403)"
    can you help me ? how can i fix this problem ?
    iPhone 4, iOS 7
    iPhone 4S, iOS 7, (com.apple.appleaccount error 403)"

    Error: com.apple.appleaccount error 403
    Recreate Error: On a Iphone/Ipad device that has "already" created the maximum of 3 per device Apple limit of ICloud account creation attempt to create or login to ICloud service tab in Settings. You will be presented with "com.apple.appleaccount error 403" which does not tell the laymen anything useful.
    Cause: IOS 7 reports a "best guess" error instead of detailed error explanation.
    How To Resolve Error: Find a device that has not been used to create an ICloud account the maximum 3 times and use it to create the ICloud account by logging into the Settings/ICloud tab with the Apple ID you want a ICloud account created for.
    Keep in mind this will use up one of the three lifetime allowed ICloud account creations allowed by Apple on that device.
    Also per support: If an existing account is logged into the ICloud service. A. Backup phone using iTunes on a mac/pc. B. At bottome of Settings/ICloud Delete the account "AND" all the user date from the phone. It will offer the Delete all data option. The reason for Deletion(and is why we backed up on a pc vs. the cloud) is when you create the new ICloud account it will backup all of the Device owners information to the wrong persons account.
    Once you have created the new ICloud account log into that account on device that was presenting error: "com.apple.appleaccount error 403" it should allow the ICloud login.
    Once you have verified the "device with error" is ICloud functional delete the ICloud account from the device used to seed the ICloud account and delete again all user data from cloud. Restore the recently created mac/pc Itunes locally created backup to the phone and then go to Settings/ICloud and login with the device owners Apple ID and password and verify your backup to the ICloud settings and Eureka! your done.
    It took less time to do that for me to type this lol.

  • I have downloaded iCloud control panel but when I sign in with my iTunes username and password it say they are valid but I don't have an iCloud account and Iam lost can you help please.                                                        John

    I have downloaded iCloud control panel but when I sign in with my iTunes username and password it say they are valid but I don’t have an iCloud account and Iam lost can you help please.
    John

    You are getting this message because you are trying to create an iCloud account on a PC.  You can only create iCloud account on an iOS device (iPhone, iPad or iPod Touch) running iOS 5 or higher, or on a Mac running OS X Lion (10.7.5) or higher.  After creating your account on one of these devices you will then be able to sign into the account using this ID on your PC.

  • HT204406 I have received an error message when i try to start iTunes Match, "We coulnd not complete your iTunes Store request.  An unknown error occurred (4001).  Can you help with this error?

    I subscribed to iTunes Match, but after the information is gathered about my iTunes library, i get an error message :  "We could not complete your iTunes Store request.  An unknown error occurred (4001).  Try again later." 
    Can you help fix this error?

    Yesterday I went to settings in my iPhone, Music, turned iTunes Match to "Off".  I then updated Match in iTunes and it worked!  I don't know why, but it worked.

  • TS3899 Trying to send email to favorites on my list of contacts but will not recognize them can you help.?

    I am trying to send an email to favorites on my list of contacts but my IPad will not recognize it can you help?

    Hi Ralph, a new message sign comes up.  I put email address in,but it does not allow me to type anywhere other than section at the bottom. Of the page. There is no subject or comment line showing.

  • I don't know how to setup FF to open in last session of windows wont let me save current sessions like it used to ask me fairly disappointing can you help m? Phil

    Question
    i don't know how to setup FF to open in last session of windows wont let me save current sessions like it used to ask me fairly disappointing can you help m? Phil

    ''want FF to open in last session of windows -- won't ask me if I want to save current sessions like it before''
    '''You can still have the old messages''', to make sure you get your tabs restored immediately, but with or without the messages and whichever way you respond to the message you can still get back your previous session through the History menu. (see item #31 "tabslost")
    * http://dmcritchie.mvps.org/firefox/firefox-problems.htm#tabslost
    You can make '''Firefox 6.0''' look like Firefox 3.6.*, see numbered items 1-10 in the following topic [http://dmcritchie.mvps.org/firefox/firefox-problems.htm#fx4interface Fix Firefox 4.0 toolbar user interface, problems (Make Firefox 4.0 thru 6.0, look like 3.6)]. ''Whether or not you make changes, you should be aware of what has changed and what you have to do to use changed or missing features.''
    * http://dmcritchie.mvps.org/firefox/firefox-problems.htm#fx4interface

  • Problem with iOS7 : I have a message on my screen "This phone is not registred as a developper phone..." or something like that, can you help me because I download the iOS7 Beta even if I was not a developper. Thank you very much if you help me.

    Problem with iOS7 : I have a message on my screen "This phone is not registred as a developper phone..." or something like that, can you help me because I download the iOS7 Beta even if I was not a developper. Thank you very much if you help me.

    JaillotJb wrote:
    I download the iOS7 Beta even if I was not a developper.
    if you downloaded it and are not a developer, then we are not allowed to help you here.  sorry.

Maybe you are looking for

  • ORA-00600: internal error code, arguments: [17182], [0xFFFFFFFF7B7C0D60], [

    Dears; any one know about this error ORA-00600: internal error code, arguments: [17182], [0xFFFFFFFF7B7C0D60], [], [], [], [], [], []

  • IPod 4G keeps crashing, freezing and shutting down randomly

    I think since the IOS7 update, my Ipod keeps on skipping songs, freezing on apps, crashing on apps and sometimes shutting down randomly. I have tried deleting from multitask, and shutting down (which only works for like 10 mins). How can I fix this?

  • Extending VOs with attributes and creating new treetable columns

    Hi, I am relatively new to the ADF scene so please bear with if what I have in my mind is not even possible with ADF. I have searched hi and lo for a solution and now I thoughts it time to ask the community. Anyways this is what I want to do. I have

  • Adobe Fixes Critical Problem, Keeps Fix from Some Users

    Before explaining my situation, I'll ask my question for the community up front: Is there a way for a single retail-licence holder like myself to get this patch or otherwise fix the text entry box focus problem? (Don't post stolen versions of the pat

  • Wireless Guest with NAC Server

    Hi All, Anyone knows why Sponsor can't create a guest account with 1 month duration. Its a NAC running on 2.1 version in SNS-3415-K9. The current setup is WLC connected to NAC Server. Is it related to Account type? From the Account Type dropdown menu