Click here to Skip to main content
15,903,854 members
Home / Discussions / C#
   

C#

 
GeneralRe: is this one possible ? Pin
leppie2-Mar-03 2:43
leppie2-Mar-03 2:43 
GeneralRe: is this one possible ? Pin
jtmtv182-Mar-03 11:56
jtmtv182-Mar-03 11:56 
QuestionHow to get AppInfo/Documentation from an XML Schema via XmlDocument (DOM) in C#? Pin
Mirco J. Nimmrichter27-Feb-03 23:12
Mirco J. Nimmrichter27-Feb-03 23:12 
GeneralFind Printer List available... Pin
bania27-Feb-03 20:16
bania27-Feb-03 20:16 
GeneralRe: Find Printer List available... Pin
Stephane Rodriguez.28-Feb-03 20:39
Stephane Rodriguez.28-Feb-03 20:39 
GeneralThank You.. Pin
bania2-Mar-03 13:22
bania2-Mar-03 13:22 
GeneralRe: Thank You.. Pin
leppie3-Mar-03 6:28
leppie3-Mar-03 6:28 
GeneralFew Questions Pin
chito27-Feb-03 20:07
chito27-Feb-03 20:07 
GeneralRe: Few Questions Pin
Brian Olej28-Feb-03 9:45
Brian Olej28-Feb-03 9:45 
GeneralRe: Few Questions Pin
Stephane Rodriguez.28-Feb-03 20:52
Stephane Rodriguez.28-Feb-03 20:52 
Generallame encoding Pin
grv57527-Feb-03 18:25
grv57527-Feb-03 18:25 
GeneralClass Library Question .. Pin
Dato27-Feb-03 14:55
Dato27-Feb-03 14:55 
GeneralRe: Class Library Question .. Pin
David Stone27-Feb-03 15:01
sitebuilderDavid Stone27-Feb-03 15:01 
GeneralRe: Class Library Question .. Pin
leppie27-Feb-03 20:54
leppie27-Feb-03 20:54 
GeneralRe: Class Library Question .. Pin
David Stone28-Feb-03 4:22
sitebuilderDavid Stone28-Feb-03 4:22 
GeneralRe: Class Library Question .. Pin
leppie28-Feb-03 6:02
leppie28-Feb-03 6:02 
GeneralRe: Class Library Question .. Pin
David Stone28-Feb-03 14:13
sitebuilderDavid Stone28-Feb-03 14:13 
GeneralRe: Class Library Question .. Pin
leppie28-Feb-03 22:40
leppie28-Feb-03 22:40 
GeneralThis is an easy one... really! Pin
codeweenie27-Feb-03 14:25
codeweenie27-Feb-03 14:25 
GeneralRe: This is an easy one... really! Pin
Furty27-Feb-03 14:42
Furty27-Feb-03 14:42 
GeneralRe: This is an easy one... really! Pin
David Stone27-Feb-03 14:42
sitebuilderDavid Stone27-Feb-03 14:42 
GeneralTcpClient.Close Pin
monrobot1327-Feb-03 13:51
monrobot1327-Feb-03 13:51 
GeneralRe: TcpClient.Close Pin
monrobot1328-Feb-03 3:18
monrobot1328-Feb-03 3:18 
I guess what I wrote above isn't really making sense so here's some code to explain it. The code below is simply a variable in the class:
private Pop3Client popClient = new Pop3Client ();
Now the next piece of code is what is executed when I press the connect button:
popClient.Connect (server)  // <-- Internally this method calls the Connect () method
...
protected string Connect ()
		{
			string temp;

			if (!Active) {
				//Active = true;
				popClient.Connect (server, 110);
			}
			else
				return ("Client is already connected.");

			try {
				streamWrite = PopClient.GetStream ();
				streamRead = new StreamReader (PopClient.GetStream ());

				state = ConnectState.AUTHORIZATION;
				temp = streamRead.ReadLine ();
			}

			catch (InvalidOperationException ex) {
				temp = "Error in Connect (): " + ex.ToString ();
			}

			return temp;
		}
The next code is called when I press the disconnect button:
public string Disconnect ()
		{
			string temp = "";

			if (state != ConnectState.DISCONNECTED) {
				try {
					temp = QUIT ();
					//streamWrite.Close ();
					//streamRead.Close ();
					//base.Close ();
					state = ConnectState.DISCONNECTED;
				}
				catch (SocketException ex) {
					Debug.Write ("Error in Disconnect (): " + ex.ToString ());
				}
				temp += "\r\n" + "*** Disconnected Successfully ***";
			}
			else
				temp = "Not connected";

			//streamWrite.Close ();
			//streamRead.Close ();
			Close ();
			return temp;
		}
When I press connect and then disconnect it works the first time, but when I click connect again I'm getting an error in the popClient.Connect (server, 110); line. It tells me that the socketed is already connected even though I'm call Close () in the Disconnect method.
Please help!
Thanks!

- monrobot13
GeneralRe: TcpClient.Close Pin
James T. Johnson28-Feb-03 4:54
James T. Johnson28-Feb-03 4:54 
GeneralDeploying an app w/ DB connectivity Pin
Eric VanWieren27-Feb-03 12:36
Eric VanWieren27-Feb-03 12:36 

General General    News News    Suggestion Suggestion    Question Question    Bug Bug    Answer Answer    Joke Joke    Praise Praise    Rant Rant    Admin Admin   

Use Ctrl+Left/Right to switch messages, Ctrl+Up/Down to switch threads, Ctrl+Shift+Left/Right to switch pages.