As the comment noted, the client is not sending a null value.
The isConnected() method does not do what you think it does, namely it does not tell you if the socket is currently "connected" to its peer, at least in the way you think it should. isConnected() becomes true as soon as the socket transitions into the connected state, and stays true thereafter, even after the socket is shutdown. See this discussion and others on stackoverflow.
The correct way to determine if the peer has shutdown the connection is to attempt to read from the socket and then examine the result for evidence of closure. Please read the Javadocs for the method you are using, they will tell you what the various return values mean. For the BufferedReader.readLine() method, it says:
Returns:
A String containing the contents of the line, not including any line-termination characters, or null if the end of the stream has been reached
Throws:
IOException - If an I/O error occurs
Thus you need to check for a null return value to detect a normal socket closure, and if you receive an IOException that indicates some kind of network anomaly.
Answer from President James K. Polk on Stack OverflowAs the comment noted, the client is not sending a null value.
The isConnected() method does not do what you think it does, namely it does not tell you if the socket is currently "connected" to its peer, at least in the way you think it should. isConnected() becomes true as soon as the socket transitions into the connected state, and stays true thereafter, even after the socket is shutdown. See this discussion and others on stackoverflow.
The correct way to determine if the peer has shutdown the connection is to attempt to read from the socket and then examine the result for evidence of closure. Please read the Javadocs for the method you are using, they will tell you what the various return values mean. For the BufferedReader.readLine() method, it says:
Returns:
A String containing the contents of the line, not including any line-termination characters, or null if the end of the stream has been reached
Throws:
IOException - If an I/O error occurs
Thus you need to check for a null return value to detect a normal socket closure, and if you receive an IOException that indicates some kind of network anomaly.
Your MainClient() have no problem.
clientSocket.isConnected() function in MainServer() always check the status of the client and which results an infinite loop, so after the message 'client:4', clientInput.readLine() should return 'null'.
So instead of checking the client socket is connected or not you can check the client socket is closed or not using function 'clientSocket.isClosed()'.
replace the while loop in MainServer() with below code,
while(!clientSocket.isClosed()) {
clientMsg = clientInput.readLine();
System.out.println("Client : " + clientMsg);
if(clientMsg.equals("Closed")){
clientSocket.close();
// serverSocket.close();
}
}
this will help you to close the client socket at the time of receiving 'Closed' message from server and this avoid the infinite execution of while loop as well as null statement printing. The code "serverSocket.close()" help you to close the server socket and you can use this at 'MainServer()' if you need to stop the port listening.
Videos
Related to : SMS messages just have "null"
Try this,
delete their contact
then
Settings > Applications > Manage Applications > Select the Messaging App
Choose 'Clear Data' and also 'Clear Cache'.
N.B. you will lose all data / txt msg's in your phone
(don't forget to write their number down to save as new afterwards!)
You could also check on http://www.google.com/contacts and check if the address book entry for that person is missing some information.
This is the notification that I've received. I would really like to know who the girl is, but I'm afraid of opening the notification in case this is a virus? Will opening the notification show me this girl's name?
I unsent a message for everyone, the message is deleted but the message is "null unsent a message"
The Sender[null] that you're seeing is normal behaviour. The ask method ? takes an implicit parameter sender with default value ActorRef.noSender. Normally, if you're inside an Actor you have an implicit ActorRef in scope called self, but since you're not in an Actor it's just taking the default.
It's likely that the cause of your error is that the Actor that receives your message just isn't responding in time.
I think you are not using routing over here that's why you are getting the timeout exception. for example, suppose your one request taking 1 second to get executed. and suppose you are getting 4 requests at a time and when the requests come to an actor it appends in a queue and for every request you are waiting for 8 seconds. so in the queue suppose 4th request will execute in 4 seconds so you will get the response within 8 seconds. But when 100 requests come at a time and your one actor will be available to process them and for the 100th request it will take 100 seconds to get executed but you are waiting only 8.second for the 100th request that's why you are getting the timeout exception.
so the solution is, you can use routing here for example -
system.actorOf(RoundRobinPool(concurrency).props(Props(new MyActor())))
and you can set concurrency on your system available process. suppose so set concurrency value 100 so now for the 100th request, it will take only 2 seconds to get executed. so I think routing can be a solution.
and if you don't know how many requests will be there it may be 1k or maybe more then it then you can go with dynamic creation of the actor where you can create the actor dynamically as per the request. so whenever a request will come, your one separate actor will be there to give the service for it.
I keep getting a Facebook Messenger notification on my phone every 20 minutes that says " null sent a message "
Google does not have any results. Even when I throw quotes around the search, Google still is not providing anything relevant. All Google shows when searching with quotes is YouTube to MP3 results and NONE actually include "null sent a message"
Checking my messages, there are no messages but I am getting this every 20 minutes
What does this mean?
Hi Www_w_,
There are several causes why users receive NDR when sending emails. NDRs include a code that indicates why your email isn’t delivered, you can refer to the list in this article.
In your case, the emails you send have an invalid sender address (null sender), so it would be rejected by Office 365. Sometimes a rejected message will appear as “550 5.7.512 Access denied, message must be RFC 5322 section 3.6.2 compliant and include a valid From address”. This is an expected behavior, as the NDR cannot be sent back to the sender whose address is invalid. Therefore, NDR will not be sent and it will be “discarded”
We appreciate your understanding and patience.
Best Regards,
Ruel
Thank you very much.
Please teach me.
>NDR will not be sent and it will be “discarded”
Exchange server have undeliverable queue and later, the NDR threw away?
Or when the message is null sender, Exchange server discard soon?
Well, and please teach me.
When my tenant's exchange server makes the NDR, exchange server send external smtp server the exchange online's NDR.
And exchange server discards the original message of external smtp server.
Is my understanding correct?
Please teach me.
The original message discard soon? Or is there the original message in exchange server's queue?
This URL is Exchange 2010.
https://technet.microsoft.com/en-US/library/bb232161%28v=exchg.141%29.aspx?f=255&MSPPError=-2147217396
This URL is Exchange 2013
https://technet.microsoft.com/en-US/library/bb125022(v=exchg.150).aspx
Well.....So, I think. Maybe, exchange online stores the discard message in "Unreachable queue" too**.**
Undeliverable