Connected with server, but commands do not seem to arrive..
Hello there,
I'm trying to create a connection with an IMAP server which is secured
through SSL. I can get the connection just fine, and I get a first respone
from the server. But then I send out my login string, and it does not seem
to arrive at the server, because I don't get an answer returned! After some
time, I receive a message from the server saying that I've been idle for too
long, and then the connection gets closed..
But why doesn't my data arrive at the server? (because I believe that 's the
problem here).
I realy hope someone could help me out :)
CheckIMAP.java:
import java.io.*;
import java.net.*;
import javax.net.*;
import javax.net.ssl.*;
import java.security.*;
public class CheckIMAP
static Socket imap = null;
static OutputStreamWriter outStream = null;
static InputStream inStream = null;
static BufferedReader reader = null;
static int currentState = 0; /* 0 = nothing, 1=connecting, 2= login */
//public CheckIMAP(String host, String user, String password, int port)
public static void main(String[] args)
SSLContext sc = null;
String line = null;
// server information
String host = "server";
int port = 993;
try
// Create a trust manager that does not validate certificate
chains
TrustManager[] trustAllCerts = new TrustManager[]{
new X509TrustManager() {
public java.security.cert.X509Certificate[]
getAcceptedIssuers() {
return null;
public void checkClientTrusted(
java.security.cert.X509Certificate[] certs, String
authType) {
public void checkServerTrusted(
java.security.cert.X509Certificate[] certs, String
authType) {
// Install the all-trusting trust manager
try
sc = SSLContext.getInstance("SSL");
sc.init(null, trustAllCerts, new
java.security.SecureRandom());
catch (Exception e)
e.printStackTrace();
// connect with the IMAP server
currentState = 1;
SocketFactory socketFactory = sc.getSocketFactory();
imap = socketFactory.createSocket(host, port);
outStream = new OutputStreamWriter(imap.getOutputStream());
inStream = imap.getInputStream();
reader = new BufferedReader(new
java.io.InputStreamReader(inStream));
line = reader.readLine();
while(line != null)
print(line);
System.out.println("** CurrentState: "+currentState);
readData(line);
line = reader.readLine();
close();
catch(UnknownHostException e)
System.out.println("UnknownHostException has been caught.");
e.printStackTrace();
catch(IOException e)
System.out.println("IOException has been caught");
e.printStackTrace();
public static void readData(String line)
if( line.substring(0,4).equalsIgnoreCase("* OK") )
// connection ok, now authenticate
System.out.println("** Connected to IMAP server");
write("A001 LOGIN foo bar");
currentState = 2;
else
// Connection failed, abort
System.out.println("** Connection failed, aborting");
close();
// close the socket and all the streams
public static void close()
try
System.out.println("** Closing all connections.");
inStream.close();
outStream.close();
imap.close();
reader.close();
catch(IOException e)
System.out.println("IOException has been caught");
e.printStackTrace();
// sent a command to the server
public static void write(String cmd)
try
outStream.write(cmd);
outStream.flush();
catch(IOException e)
System.out.println("IOException has been caught");
e.printStackTrace();
System.out.println("--> "+cmd);
// print out every line received from the server
public static void print(String rcvd)
System.out.println("<-- "+rcvd);
}Many thanks for any help!!
Steven
Are you sending a line terminating \n or \r\n or whatever the protocol requires...?
Similar Messages
-
When I first unlock my iPhone, it says I have connection to internet. But when I do something that requires internet, it either does not load, or it gives me a connection error message. I just got this phone yesterday from my mom and she barley used it. I have tried factory resetting it but it wont let me.
Hi Bdegroot8,
Thanks for using Apple Support Communities. Based on what you stated, it sounds like the iPhone is having trouble with Wi-Fi. It looks like you have already done some troubleshooting. I would recommend that you read these articles, they may be helpful in troubleshooting your issue.
If your iPhone, iPad, or iPod touch won’t connect to a Wi-Fi network - Apple Support
iOS and OS X: Recommended settings for Wi-Fi routers and access points - Apple Support
If the iPhone is not able to be restored, follow this article.
If you can't update or restore your iPhone, iPad, or iPod touch - Apple Support
Cheers,
Mario -
I tried to register my ipad thru the Apple website but it won't let me register because I do not have the exact purchase date. This was a gift and I do not know the exact date. So frustrating because I am excited and anxious to use my new ipad!
Try making up a date. something relatively recent. See if that allows you to go forward
-
I have an Apple Trackpad that shows that it is connected with Bluetooth but it is not responding. I've tried restarting the computer, disconnecting and reconnecting and also turning the trackpad on and off but it simply does not respond. Does anyone have any idea on what is going on here?
There are reports of similar behavour but generally it is due to battery connections. Is the indicator light working steadily or does it blink or even not function. Here is the Apple document dealing with some of the problems.
http://manuals.info.apple.com/MANUALS/1000/MA1544/en_US/Magic_Trackpad_UG.pdf
Is your machine within the guarantee period or under Apple care. If so, return it to any apple retailer for examination and possible replacement. -
Can not communicate any with Server, BUT I CAN CONNECT SUCCESS FROM "MANAGE SITES"
I can NOT see Server Files in dw cs6 , so i can NOT upload/download or communicate any with Server, BUT I CAN CONNECT SUCCESS FROM "MANAGE SITES"...WELL WHERE THE PROBLEM?
From the File view pop-up menu, choose Remote server
-
A pop-up window advising of software update for Firefox appears and does not connect with server
The window suggests strongly that I update software but when I attempt to update it does nothing but try to connect with server and never does
* http://kb.mozillazine.org/Software_Update (Software Update not working properly)
Remove the files in the updates and updates\0 folder.
You may need to delete active-update.xml and updates.xml as well if present.<br />
XP:
C:\Documents and Settings\<user>\Local Settings\Application Data\Mozilla\Firefox\Mozilla Firefox\updates
(%USERPROFILE%\Local Settings\Application Data\Mozilla\Firefox\Mozilla Firefox)
If you have problems with updating then best is to download the full version and uninstall the currently installed version.
You may need to remove the Firefox program folder to do a clean install of the new version.
Do a clean (re-)install:
Download a fresh Firefox copy and save the file to the desktop.
* Firefox 4.0.x: http://www.mozilla.com/en-US/firefox/all.html
* Uninstall your current Firefox version and remove the Firefox program folder before installing that copy of the Firefox installer.
* Do not remove personal data if you uninstall the current version.
* It is important to delete the Firefox program folder to remove all the files and make sure that there are no problems with files that were leftover after uninstalling.
Your bookmarks and other profile data are stored elsewhere in the [http://kb.mozillazine.org/Profile_folder_-_Firefox Firefox Profile Folder] and won't be affected by a reinstall, but make sure that you do not select to remove personal data if you uninstall Firefox. -
Client Not connected with Server
Hi Experts
I upgraded my Patch level from 9.0 PL8 to PL9. Server and Clients are installed and it is working fine but one PC not connected with Server. While I Connect SAP in landscape server selection Page Port Number shown as 40000 instead of 30000. I changed Port No from 40000 to 30000 the error Message came as [message 60070-99999987}. I attached the Screen shot in this discussion.
Please help me to resolve this issue.
With Regards
Balaji SampathI have same problem and this is the solution
Go to the directory C:\Program Files (x86)\SAP\SAP Business One\Conf
Copy the file b1-current-user.xml and put it aside
Go to the directory %USERPROFILE%\Local Settings\Application Data\SAP\SAP Business One
Check the file b1-current-user.xml which is likely empty or wrong strings
Rename the b1-current-user.xml file for backup
Move the copied file into the directory.
License server name asked every time on login -
Can anyone help I have just taken an iPhone4s but can't get it to sync with my Outlook calender I have downloaded to my PC the iCloud software but that does not seem to have helped at all?
Thanks Bazzer50Do you see your Outlook calendar on the iCloud website?
Do you see your iCloud calendar on your iPhone?
This Apple article is a good place to start -> iCloud: Troubleshooting iCloud Calendar -
I have a ipod classic 160GB , the problem with it is that it is dead no respond at all, i even tried to do a hard reboot, i tried to connect to itunes but it did not work, if somebody has a solution please let me know! the screen on the ipod shows nothing........
This is the iPod touch forum. I will request that you post be moved to the iPod Classic forum.
-
My iPod is disabled, but not because I forgot the password. It says I need to connect with iTunes, but when I try it says I need to enter the password. What do I do?
Disabled
Place the iOS device in Recovery Mode and then connect to your computer and restore via iTunes. The iPod will be erased.
iOS: Wrong passcode results in red disabled screen
If recovery mode does not work try DFU mode.
How to put iPod touch / iPhone into DFU mode « Karthik's scribblings
For how to restore:
iTunes: Restoring iOS software
To restore from backup see:
iOS: How to back up
If you restore from iCloud backup the apps will be automatically downloaded. If you restore from iTunes backup the apps and music have to be in the iTunes library since synced media like apps and music are not included in the backup of the iOS device that iTunes makes.
You can redownload most iTunes purchases by:
Downloading past purchases from the App Store, iBookstore, and iTunes Store
If problem what happens or does not happen and when in the instructions? When you successfully get the iPod in recovery mode and connect to computer iTunes should say it found an iPod in recovery mode. -
my apple ipad is disabled and saying connect to itunes. i tried to connect with itunes but not responding
Connect to iTunes on the computer you usually Sync with and “ Restore “...
http://support.apple.com/kb/HT1414
If necessary Place the Device into Recovery mode...
http://support.apple.com/kb/ht4097 -
I use iPhone 4S .earlier with ios 6 and now ios 6.while I connect the charger for charging my phone network lost while midway in charging.that problem always while 3G connection is active.but this problem not arise while 3G mode off.please help me.
reset all settings
settings-general-reset-reset all settings
now reconnect to wifi
settings- wifi- click network name- enter password - join
if issue persists back up and restore as new via iTunes
Peace, Clyde -
I am trying to set up internet sharing from my macbook air but there does not seem to be an option for this because the air is connected to the internet via wifi connection. Is it possible to still share this?
It depends upon how the other machines are connecting to your MBA:
If the the other machines are also using wi-fi, they can connect directly to the wireless access point (router) without going through your MBA
If the other machines are connecting to the MBA using ethernet you can share your wi-fi connection to them -
After downloading InCopy I click on the downloaded file to install, but the process stops when trying to connect with server and doesn't carry on. Can you please help?
Thanks,Agathe.texier which copy of InCopy are you downloading and installing? Do you receive any specific error messages? Finally what operating system are you using?
-
For about two days now, the bbm application has refused to launch. It has been writing lost connection with server....can any one please help! It's really urgent
Hi and Welcome to the Community!
With a strong carrier network signal (e.g., not merely WiFi), I suggest the following steps, in order, even if they seem redundant to what you have already tried (step should result in a message coming to your BB...please wait for that before proceeding to the next step):
1) Register HRT
KB00510 How to register a BlackBerry smartphone with the wireless network
Please wait for one "registration" message to arrive
2) Reboot
Pre-BB10 Devices ONLY. With power ON, remove the back cover and pull out the battery. Wait about a minute then replace the battery and cover. Power up and wait patiently through the long reboot -- ~5 minutes.
BB10 Devices. Hold the top button down until the counter reaches zero. Wait for the device to be fully shut down (e.g., nothing at all displayed on the screen, no LED lights, etc.). Hold the top button until the red LED is lit. Wait through the full boot-up process. IF this fails, you can attempt the battery-pull method above, but it is normally NOT recommended unless nothing else works.
See if things have returned to good operation. Like all computing devices, BB's suffer from memory leaks and such...with a hard reboot being the best cure.
Hopefully that will get things going again for you! If not, then you should contact your mobile service provider for formal support.
Good luck!
Occam's Razor nearly always applies when troubleshooting technology issues!
If anyone has been helpful to you, please show your appreciation by clicking the button inside of their post. Please click here and read, along with the threads to which it links, for helpful information to guide you as you proceed. I always recommend that you treat your BlackBerry like any other computing device, including using a regular backup schedule...click here for an article with instructions.
Join our BBM Channels
BSCF General Channel
PIN: C0001B7B4 Display/Scan Bar Code
Knowledge Base Updates
PIN: C0005A9AA Display/Scan Bar Code
Maybe you are looking for
-
For the present Word version (365) I have not found a way to be able to use the entire/total/really full screen estate when using writing mode in Word. (Perhaps there is a way, not discovered by me yet?) But what I want both in Word 365 and foremost
-
I have an older iMac G5 OSX 10.4.11. I currently have Safari 4.1.3 and I am being told by some of the web sites I use that they no longer support that version of Safari. What is the latest update I can get and how?
-
Hi, Need your inputs. Details mentioned below: Program needs to compare values between 2 variables. However, the comparison operators (EQ, NE, GT, GE, LT, LE) are retrieved from a custom table and my code needs to compare based on the values returned
-
Error: connecting to db with SQL Developer
Hi, I have just done a test disaster recovery (complete restore and recovery) of my database. I have successfully restored and recovered my database and managed to open the database , though with a few warnings shown below RMAN> alter database open r
-
Revision: 11118 Author: [email protected] Date: 2009-10-23 16:35:38 -0700 (Fri, 23 Oct 2009) Log Message: Did some code cleanup on the Spark components to enforce the conventions about how to order stuff within an AS file. QE notes: None Doc no