My simple chat server does not send messages to connected clients
Hi!
I´m developing a chat server. But I can not get it work. My client seems to make a connection to it, but my server does not send the welcome message it is supposed to send when a client connects. Why not?
removedEdited by: Roxxor on Nov 24, 2008 10:36 AM
Ok, I solved my previous problem and now I have got a new really annoying one.
This is a broadcasting server which meand it can handle multiple clients and when one client sends a message to the server, the server should broadcast the message to all connected clients. It almost works, except that the server just sends the message back to the last connected client. The last connected client seems to steal the PrintStream() from the other clients. How can I solve that?
import java.io.*;
import javax.microedition.io.*;
import javax.microedition.midlet.*;
import javax.microedition.lcdui.*;
import java.lang.Character;
import java.io.OutputStream;
import java.util.Vector;
public class ChatServer extends MIDlet implements CommandListener, Runnable
private Display disp;
private Vector connection = new Vector();
private TextField tf_port = new TextField("Port: ", "", 32, 2);
private Form textForm = new Form("Messages");
private Form start_serverForm = new Form("Start server", new Item[] { tf_port });
private Command mExit = new Command("Exit", Command.EXIT, 0);
private Command mStart = new Command("Start", Command.SCREEN, 0);
private Command mDisconnect = new Command("Halt server", Command.EXIT, 0);
ServerSocketConnection ssc;
SocketConnection sc;
PrintStream out;
public ChatServer()
start_serverForm.addCommand(mExit);
start_serverForm.addCommand(mStart);
start_serverForm.setCommandListener(this);
tf_port.setMaxSize(5);
textForm.addCommand(mDisconnect);
textForm.setCommandListener(this);
public void startApp()
disp = Display.getDisplay(this);
disp.setCurrent(start_serverForm);
public void pauseApp()
public void destroyApp(boolean unconditional)
public void commandAction(Command c, Displayable s)
if(c == mExit)
destroyApp(false);
notifyDestroyed();
else if(c == mStart)
Thread tr = new Thread(this);
tr.start();
else if(c == mDisconnect)
try
sc.close();
catch(IOException err) { System.out.println("IOException error: " + err.getMessage()); }
destroyApp(false);
notifyDestroyed();
public void run()
try
disp.setCurrent(textForm);
ssc = (ServerSocketConnection)Connector.open("socket://:2000");
while(true)
sc = (SocketConnection) ssc.acceptAndOpen();
connection.addElement(sc);
out = new PrintStream(sc.openOutputStream());
textForm.append(sc.getAddress() + " has connected\n");
ServerToClient stc = new ServerToClient(sc);
stc.start();
catch(IOException err) { System.out.println("IOException error: " + err.getMessage()); }
catch(NullPointerException err) { System.out.println("NullPointerException error: " + err.getMessage()); }
class ServerToClient extends Thread
String message;
InputStream in;
SocketConnection sc;
ServerToClient(SocketConnection sc)
this.sc = sc;
public void run()
try
in = sc.openInputStream();
int ch;
while((ch = in.read())!= -1)
System.out.print((char)ch);
char cha = (char)ch;
String str = String.valueOf(cha);
out.print(str);
//broadcast(str);
textForm.append(str);
in.close();
//out.close();
sc.close();
catch(IOException err) { System.out.println("IOException error: " + err.getMessage()); }
}
Similar Messages
-
ICloud IMAP server does not send the CAPABILITY with CRLF
IMAP iCloud server does not send the CAPABILITY response with CRLF appended as per RFC 3501. Please find the log snippet
11-05 10:50:52.462 29603 29988 D Email : open :: socket openjava.io.BufferedInputStream@43a726a8 | java.io.BufferedOutputStream@43a72b68
11-05 10:50:52.502 29603 29988 D Email : <<< #null# ["OK", ["CAPABILITY", "st11p00mm-iscream023", "1S", "XAPPLEPUSHSERVICE", "IMAP4", "IMAP4rev1", "SASL-IR", "AUTH=ATOKEN", "AUTH=PLAIN"], "iSCREAM ready to rumble (1S:1092) st11p00mm-iscream023 [42:4469:15:50:53:39]"]
11-05 10:50:52.502 29603 29988 D Email : >>> 1 CAPABILITY
11-05 10:50:52.552 29603 29988 D Email : <<< #null# ["CAPABILITY", "st11p00mm-iscream023", "1S", "XAPPLEPUSHSERVICE", "IMAP4", "IMAP4rev1", "SASL-IR", "AUTH=ATOKEN", "AUTH=PLAIN"]
11-05 10:50:52.562 29603 29988 D Email : <<< #1# ["OK", "!!"]
11-05 10:50:52.582 29603 29988 D Email : >>> [IMAP command redacted]
11-05 10:50:52.682 29603 29988 D Email : <<< #2# ["OK", ["CAPABILITY", "XAPPLEPUSHSERVICE", "IMAP4", "IMAP4rev1", "ACL", "QUOTA", "LITERAL+", "NAMESPACE", "UIDPLUS", "CHILDREN", "BINARY", "UNSELECT", "SORT", "CATENATE", "URLAUTH", "LANGUAGE", "ESEARCH", "ESORT", "THREAD=ORDEREDSUBJECT", "THREAD=REFERENCES", "CONDSTORE", "ENABLE", "CONTEXT=SEARCH", "CONTEXT=SORT", "WITHIN", "SASL-IR", "SEARCHRES", "XSENDER", "X-NETSCAPE", "XSERVERINFO", "X-SUN-SORT", "ANNOTATE-EXPERIMENT-1", "X-UNAUTHENTICATE", "X-SUN-IMAP", "X-ANNOTATEMORE", "XUM1", "ID", "IDLE"], "User test logged in"]
11-05 10:50:52.682 29603 29988 D Email : >>> 3 CAPABILITY
11-05 10:50:52.742 29603 29988 W Email : Exception detected: Expected 000a (
)1-05 10:50:52.742 29603 29988 W Email : ) but got 000d (
This is happening only when CAPABILITY command is sent follwed by LOGIN command. Please check this issue.If you want your mail delivered properly the Official Host Name of the sending server should match the PTR (reverse DNS) of the sending IP Address, and there should be an "A" record that matches the OHN as well.
Example:
mail.yourdomain.com (Official Host Name) on 123.123.123.123
PTR for 123.123.123.123 should match mail.yourdomain.com
There should be an A record in yourdomain.com pointing to 123.123.123.123
Kostas -
The XI does not send messages with correct IDOC structure
SAP XI 3.0 sends to ECC IDOC HRMD_A07
The XI does not send messages with correct IDOC structure.
In XI Design, Software Component RHEVOLU, Ive imported the Objects
HRMD_A.HRMD_A07 from SAP ECC; In Tools -> Export Reduced XSD, I saved
HRMD_A.HRMD_A07.xsd in Namespace http://suezambiental.com.br/HR . At
Message Mapping -> mmAdmissao, in Imported Message -> Import XML or
XSD, I imported the reduced Idoc file generated above, mapping source
fields to target fields.
The IDOC sent from XI to ECC has this structure (template: 22122)
E1PLOGI
E1PORIG
E1PITYP
E1P0000
E1P0001
E1P0002
Status 53 -HR: ALE inbound processing for HR master data
But does not update HR Master data.
The structure expected in ECC side (template: 20376) is:
E1PLOGI
E1PORIG
E1PITYP
E1P0000
E1PITYP
E1P0001
E1PITYP
E1P0002
Status 53 -HR: ALE inbound processing for HR master data
By using WE19 transaction, this structure was changed manually; so, the
HR Master data was updated.
Witch kind of customizing or correction could be made in XI, to send
the correct structure to ECC?
Best Regards
ClaudioHi Claudio,
In your case, there are perhaps two causes:
1. perhaps when you have import the idoc, for a strange reason, a bad metadata was created by XI. You can clean this one in tcode <b>IDX2</b> (Idoc metadata cache).
2. but it's also probably an error in your Message Mapping. Have you correctly manage segment E1PITYP?
Regards
Mickael -
I have a problem with the mail server.
He sends some mails not to other mail servers.
I get back the message with the error:
host mail.domain.de [...IP...] said: 554 5.7.1
<unknown [...IP...]>: Client host rejected: <-- please use SMTP-AUTH
for mail delivery, POP-before-SMTP support has been expired
The SMTP Logfile:
Jan 14 12:04:23 server postfix/smtp[77846]: 81FD09116D: to=<[email protected]>, relay=mail.domain.de[…IP…]:25, delay=0.12, delays=0/0.01/0.08/0.04, dsn=5.7.1, status=bounced (host mail.domain.de[…IP…] said: 554 5.7.1 <unknown[...IP...]>: Client host rejected: <-- please use SMTP-AUTH for mail delivery, POP-before-SMTP support has been expired --- bitte nutzen Sie SMTP-AUTH zum Mailversand, POP-before-SMTP wird nicht mehr unterstuetzt: <a class="jive-link-external-small" href="http://">http://smtp-auth.info --> (in reply to RCPT TO command))
Jan 14 12:04:27 server postfix/cleanup[77842]: A5F9A91170: message-id=<[email protected]>
Jan 14 12:04:27 server postfix/bounce[77847]: 81FD09116D: sender non-delivery notification: A5F9A91170
Jan 14 12:04:27 server postfix/qmgr[77776]: A5F9A91170: from=, size=3504, nrcpt=1 (queue active)
Jan 14 12:04:27 server postfix/qmgr[77776]: 81FD09116D: removed
postconf -n
biff = no
command_directory = /usr/sbin
config_directory = /etc/postfix
content_filter = smtp-amavis:[127.0.0.1]:10024
daemon_directory = /usr/libexec/postfix
debugpeerlevel = 2
enableserveroptions = yes
header_checks = pcre:/etc/postfix/customheaderchecks
html_directory = /usr/share/doc/postfix/html
inet_interfaces = all
localrecipientmaps =
mail_owner = _postfix
mailboxsizelimit = 0
mailbox_transport = dovecot
mailq_path = /usr/bin/mailq
manpage_directory = /usr/share/man
messagesizelimit = 10485760
mydestination = $myhostname, localhost.$mydomain, localhost, $mydomain
mydomain = home.de
mydomain_fallback = localhost
mynetworks = 127.0.0.0/8,192.168.112.0/24
newaliases_path = /usr/bin/newaliases
queue_directory = /private/var/spool/postfix
readme_directory = /usr/share/doc/postfix
recipient_delimiter = +
relayhost =
sample_directory = /usr/share/doc/postfix/examples
sendmail_path = /usr/sbin/sendmail
setgid_group = _postdrop
smtpsasl_authenable = no
smtpsasl_passwordmaps =
smtpdclientrestrictions = permit_mynetworks permitsaslauthenticated permit
smtpdenforcetls = no
smtpdhelorequired = yes
smtpdhelorestrictions = rejectinvalid_helohostname rejectnon_fqdn_helohostname
smtpdpw_server_securityoptions = gssapi,cram-md5,login,plain
smtpdrecipientrestrictions = permitsaslauthenticated permit_mynetworks rejectunauthdestination checkpolicyservice unix:private/policy permit
smtpdsasl_authenable = yes
smtpdtlsCAfile = /etc/certificates/server.home.de.2348FC1580BA9FB417961D5931800EFA6B331800.chain .pem
smtpdtls_certfile =
smtpdtls_excludeciphers = SSLv2, aNULL, ADH, eNULL
smtpdtls_keyfile =
smtpdtlsloglevel = 0
smtpduse_pwserver = yes
smtpdusetls = no
unknownlocal_recipient_rejectcode = 550
virtualaliasdomains = $virtualaliasmaps
virtualaliasmaps =
What is wrong?
Message was edited by: kadametz
Message was edited by: kadametzIf you want your mail delivered properly the Official Host Name of the sending server should match the PTR (reverse DNS) of the sending IP Address, and there should be an "A" record that matches the OHN as well.
Example:
mail.yourdomain.com (Official Host Name) on 123.123.123.123
PTR for 123.123.123.123 should match mail.yourdomain.com
There should be an A record in yourdomain.com pointing to 123.123.123.123
Kostas -
My Iphone 4 is not sending Imessage, but when I turn it off, I can text? What can I do to fix my phone?
iMessage is separate from texting - SMS/MMS.
http://support.apple.com/kb/ts2755 -
Server does not get a socket connect event with Apache MINA
I have this weird problem that was recently detected.
I have a server written with the Apache MINA framework that runs a Linux machine with 64 bit server JVM 6.0.
The server accept sockets from clients using our own proprietary protocol, and everything works ok for some time.
After a couple of hours, the server seems to stop getting the socket accept events (in MINA, the sessionOpened event) and the socket close event.
It seems that we can open a socket to the JVM, but the application does not know about it.
Does anyone got something like this with MINA or NIO?
Any idea?
Thanks
Ran.Ok fixed.
At a elevated cmd prompt run ;
C:\Users\administrator.TOM>setspn -x
As you can see the DC serv1 had duplicate SPNs.
Checking domain DC=TOM
Processing entry 1
HOST/serv1.TOM is registered on these accounts:
CN=SERV1,OU=Domain Controllers,DC=TOM
CN=C00049,CN=Computers,DC=TOM
{14E52635-0A95-4a5c-BDB1-E0D0C703B6C8}/TOWN-HBWJ29ZOQC is registered on these ac
counts:
CN=Administrator,CN=Users,DC=TOM
CN=TOWN-HBWJ29ZOQC,CN=Computers,DC=TOM
{14E52635-0A95-4a5c-BDB1-E0D0C703B6C8}/town-hbwj29zoqc.TOM is registered on thes
e accounts:
CN=Administrator,CN=Users,DC=TOM
CN=TOWN-HBWJ29ZOQC,CN=Computers,DC=TOM
RestrictedKrbHost/serv1 is registered on these accounts:
CN=C00049,CN=Computers,DC=TOM
CN=SERV1,OU=Domain Controllers,DC=TOM
RestrictedKrbHost/serv1.TOM is registered on these accounts:
CN=C00049,CN=Computers,DC=TOM
CN=SERV1,OU=Domain Controllers,DC=TOM
found 5 groups of duplicate SPNs.
Went to the computers OU and changed computer c00049 to the correct SPN. Now I have a new issues, I'll start a new thread. -
How can I install Firefox on a server that does not have an internet connection?
I run Firefox on a server to display graphs for a program. I was able to save, upload and install Firefox version 21 on my server because it used the executable installation program. Versions 22 and 23 use a stub program that goes to the internet and installs the program. My server does not have an internet connection, so the stub program does not work. Can I get a copy of the executable program that installs the program without having an internet connection?
hello pkautzman, the full install packets that are capable of an offline installation are available at https://www.mozilla.org/firefox/all/.
-
I have an Ipad 2 and are having problems sending out emails in one of my email address. This is a POP3 email Account? I always get a message reading that the email was not sent because the server does not allow relaying. I have no such problem with gmail. What could be the problem and how do I resolve this. Is it about settings?
Richard.Welcome to the Apple community.
If you are unable to remember your password, security questions, don’t have access to your rescue address or are unable to reset your password for whatever reason, your only option is to contact Apple ID Support, upon speaking to an operator you should explain that your problem is related to your Apple ID, this way you will not be charged for assistance, even if you don’t have an AppleCare plan.
The operator will take you through some steps you may have already tried, however they need to be sure they have exhausted all usual approaches before trying to reset your account, so you should try to be helpful and show patience with the procedure.
The operator will need to verify they are speaking to the account holder and may ask you some questions that only the account holder could know, and you will need to answer them if the process is to proceed.
Once the operator has verified your identity they will send a message through to your device which contains an alpha numeric code, which you will need to read back to them.
Once this has been completed they will send an email to your iCloud email address after a period of 24 hours, so you should check that mail is enabled in your devices iCloud settings.
Upon receipt of the email, use the reset link provided to reset your password, after which you should be able to make the adjustments to iCloud that you wish to do. -
My macbook pro with OS 10.6.7 'mail' program does not send my mail through the IPS wireless, I am connected to. The message is my 'e-mail is rejected by the server'. It has been working until 5 days ago. The connection doctor says I am connected and no log in required.
After trying lots I found now in 'Airport Utility is 'unable to detect any airport wireless devises.....'
There is no provider to be seen in airport utility and only 'rescan' is an option with no results...
even so I am connected and can browse the net receive mail etc. and the outgoing 'mail server' is set to the internet provider I am connected to.
Can you enlighten me what can I do I need to use my e-mail program urgently !!!
Thanks for your helpI'm not sure what "IPS wireless" is, but unless you have an Apple Wi-Fi base station (such as a Time Capsule, AirPort Extreme, or AirPort Express), AirPort Utility won't see anything.
You might try defining a new SMTP server to see if that will work any better.
By the way, the subject field for these messages isn't intended to hold a lot of text. Put a short description of your problem in the subject field and save the rest of your message for the body field. -
I set up my eail account so I BCC a copy of the email to my desk top. When I send an email from my IPhone I get a message stating that the recpient was rejected because the server does not allow relaying. I can send the same email, BCC myself from my desktop with no problem.
Go to Settings > Mail, Contacts, Calendars > Your Account > Account Name , tap on SMTP (under the 'Outgoing Mail Server' heading) and then tap on your Primary Server and enter your email account and password and see if things work.
-
WWhy can't I send email but can receive it. I get the message that the server does not allow relay.
Hello kathyfromfalcon,
Welcome to the Apple Support Communities!
I understand that you are unable to send email but are still receiving email. In this situation, with the relaying denied alert, I would suggest reading over the attached article and working through the steps provided.
Get help with Mail on iPhone, iPad, and iPod touch - Apple Support
Have a great day,
Joe -
My iPad won't send emails despite identical settings with iPhone which does work. " server does not recognise email address" resetting account fails to solve issue. What else can I try?
Have you checked ALL the settings including the port assignments? Easiest way to get those back to is to delete the email account from the iPad then redo the email account. Usually the ISP providing the email account will have instructions on their web site.
-
Am using Outlook calendar for Mac--needed for client connection. Invites will not go out. Error message: "server does not support secure connections." Resolution?
I have done a similar set of things and no results.
This is really odd, Mac Mail works other emasil clients work, just not Outlook.
The only event I can tie it back to is the outage a couple of weeks ago when AppleID's weren't working for a perdion of time. I ended up having to reset mine.
Is it feasible a local certificate got corrupted at the same or, oddly, that the SMTP servers don't have the updated password?
What's odd is that I no matter how much i Google, i can't find anyone else who has this problem, other than here? -
Error message when uploading: my server does not support byte-range requests
Hi I am trying to get a pocast up on itunes - I am first just sending a test mp3 - ebenezer.bruceclark.eu/podcast.xml. I have validated the xml keeping it to a minimum and constantly get the message saying my server does not support byte-range requests. Once I got some meassage about "White spaces are required between publicId and systemId". It all seems so random I am using Drupal 7 cms with views_rss module + itunes elements. It's been my 3rd night into the early morning and I need to sort this out for my client.
Thanks to anyone who can help
BruceYour feed does not contain an 'enclosure tag' which would contain the URL of your mp3 file, so at the moment it basically has no content and would be of no use to iTunes. You may find it helpful to read this page which gives you basic information on making a podcast:
http://rfwilmut.net/pc
Note that when you do get it working and submitting, the iTunes Store won't accept a podcast which is merely a technical test: they need to see at least one proper episode so that they can check that your podcast does not contain unsuitable material. -
Received an iPad for Father's Day; during email setup, not able to send a reply to an email as a message appears stateing "Message not sent as server does not allow relaying." Can receive emails with no problem. Whoes server, theirs or mine.
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/
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
Maybe you are looking for
-
Problem with PI ?xml version="1.0"? in parseEscapedXML
Hi, Our process reciveing the xml contend as string which contains the PI <?xml version="1.0" encoding="utf-8"?> i need to convert this string as xml when i use the function ora:parseEscapedXML(strvar) am getting the exception PI instruction is not a
-
Can't get Sub-forms to Display in Right order
Hello there I have a strange issue with the positioning of a series of sub-forms using Designer 8.2.1.3144. I have the following (schematic) structure (Top Level Sub-form) Sub-form 1 Label 1.1 Label 1.2 Sub-form 2 Sub-form 2.1 Test 2.1.1 Label 2.1.2
-
Doubt in Firing Query with multiple opportunities UUID/IDs
HI Folks! I might have simple doubt but please help me on this! 1. I have a custom BO with association to opportunities. [DeploymentUnit(CustomerRelationshipManagement)] businessobject Sy_Trade { [AlternativeKey] [Label("Trade Id")] element tradeid :
-
SDK2.1 VS SDK3.0
Hi all , now i meet a problem . That is , i build some assemble code into a static lib "A" with SDK 2.1 , then if my app who invoke the lib "A" builds with SDK 3.0 , it runs OK , but if my app build with SDK 2.1 , it will crash , and i find the root
-
Is there anyway to download a DVD I own on to my ipad
is there anyway to download a DVD I own, on to my ipad