467,099 Members | 1,134 Online
Bytes | Developer Community
Ask Question

Home New Posts Topics Members FAQ

Post your question to a community of 467,099 developers. It's quick & easy.

Unable to read data from the transport connection

Hi to all,

Im searching a hand to solve an Exception that i get when i try to give the
user to a gmail account...

Any help would be appreciated.. Thanks in advance

This is a piece of my code:

Server=new TcpClient("pop.gmail.com",995); //stablish a connection

Networkstream=Server.GetStream();//returns the first stream

Readerstream=new StreamReader(Server.GetStream());

username="xx*******@gmail.com";
string Data= "USER "+username + CRLF;
byte[] Data_ = System.Text.Encoding.ASCII.GetBytes(Data.ToCharArr ay());
Networkstream.Write(Data_,0,Data_.Length);
string temp=read_single_line_response();
---------------------------
The stack trace is this:
---------------------------
See the end of this message for details on invoking
just-in-time (JIT) debugging instead of this dialog box.

************** Exception Text **************
System.IO.IOException: Unable to read data from the transport connection.
---> System.Net.Sockets.SocketException: Se ha forzado la interrupción de una
conexión existente por el host remoto
at System.Net.Sockets.Socket.Receive(Byte[] buffer, Int32 offset, Int32
size, SocketFlags socketFlags)
at System.Net.Sockets.NetworkStream.Read(Byte[] buffer, Int32 offset,
Int32 size)
--- End of inner exception stack trace ---
at System.Net.Sockets.NetworkStream.Read(Byte[] buffer, Int32 offset,
Int32 size)
at System.IO.StreamReader.ReadBuffer()
at System.IO.StreamReader.ReadLine()
at GmailParser.Emailer.read_single_line_response() in c:\documents and
settings\alpha1\escritorio\gmailparsers\emailer.cs :line 148
at GmailParser.Emailer.USER() in c:\documents and
settings\alpha1\escritorio\gmailparsers\emailer.cs :line 101
at GmailParser.Emailer.Connect() in c:\documents and
settings\alpha1\escritorio\gmailparsers\emailer.cs :line 50
at GmailParser.Form1.Form1_Load(Object sender, EventArgs e) in
C:\Documents and Settings\Alpha1\Escritorio\GmailParsers\Form1.cs:l ine 78
at System.Windows.Forms.Form.OnLoad(EventArgs e)
at System.Windows.Forms.Form.OnCreateControl()
at System.Windows.Forms.Control.CreateControl(Boolean fIgnoreVisible)
at System.Windows.Forms.Control.CreateControl()
at System.Windows.Forms.Control.WmShowWindow(Message& m)
at System.Windows.Forms.Control.WndProc(Message& m)
at System.Windows.Forms.ScrollableControl.WndProc(Mes sage& m)
at System.Windows.Forms.ContainerControl.WndProc(Mess age& m)
at System.Windows.Forms.Form.WmShowWindow(Message& m)
at System.Windows.Forms.Form.WndProc(Message& m)
at System.Windows.Forms.ControlNativeWindow.OnMessage (Message& m)
at System.Windows.Forms.ControlNativeWindow.WndProc(M essage& m)
at System.Windows.Forms.NativeWindow.Callback(IntPtr hWnd, Int32 msg,
IntPtr wparam, IntPtr lparam)
************** Loaded Assemblies **************
mscorlib
Assembly Version: 1.0.5000.0
Win32 Version: 1.1.4322.573
CodeBase:
file:///c:/windowss/microsoft.net/framework/v1.1.4322/mscorlib.dll
----------------------------------------
GmailParser
Assembly Version: 1.0.2173.39969
Win32 Version: 1.0.2173.39969
CodeBase:
file:///C:/Documents%20and%20Settings/Alpha1/Escritorio/GmailParsers/bin/Debug/GmailParser.exe
----------------------------------------
System.Windows.Forms
Assembly Version: 1.0.5000.0
Win32 Version: 1.1.4322.573
CodeBase:
file:///c:/windowss/assembly/gac/system.windows.forms/1.0.5000.0__b77a5c561934e089/system.windows.forms.dll
----------------------------------------
System
Assembly Version: 1.0.5000.0
Win32 Version: 1.1.4322.573
CodeBase:
file:///c:/windowss/assembly/gac/system/1.0.5000.0__b77a5c561934e089/system.dll
----------------------------------------
System.Drawing
Assembly Version: 1.0.5000.0
Win32 Version: 1.1.4322.573
CodeBase:
file:///c:/windowss/assembly/gac/system.drawing/1.0.5000.0__b03f5f7f11d50a3a/system.drawing.dll
----------------------------------------
System.Xml
Assembly Version: 1.0.5000.0
Win32 Version: 1.1.4322.573
CodeBase:
file:///c:/windowss/assembly/gac/system.xml/1.0.5000.0__b77a5c561934e089/system.xml.dll
----------------------------------------

************** JIT Debugging **************
To enable just in time (JIT) debugging, the config file for this
application or machine (machine.config) must have the
jitDebugging value set in the system.windows.forms section.
The application must also be compiled with debugging
enabled.

For example:

<configuration>
<system.windows.forms jitDebugging="true" />
</configuration>

When JIT debugging is enabled, any unhandled exception
will be sent to the JIT debugger registered on the machine
rather than being handled by this dialog.
--
Thanks
Regards.
Josema
Dec 13 '05 #1
  • viewed: 11131
Share:
4 Replies
you can check stream CanRead property before reading from it
why do you create StreamReader? you can read directly from network stream

Also notice that StreamReader is inherited from TextReader and NetworkStream
from Stream

--
Vadym Stetsyak aka Vadmyst
http://vadmyst.blogspot.com

"Josema" <Je******@ocu.org> wrote in message
news:4D**********************************@microsof t.com...
Hi to all,

Im searching a hand to solve an Exception that i get when i try to give
the
user to a gmail account...

Any help would be appreciated.. Thanks in advance

This is a piece of my code:

Server=new TcpClient("pop.gmail.com",995); //stablish a connection

Networkstream=Server.GetStream();//returns the first stream

Readerstream=new StreamReader(Server.GetStream());

username="xx*******@gmail.com";
string Data= "USER "+username + CRLF;
byte[] Data_ =
System.Text.Encoding.ASCII.GetBytes(Data.ToCharArr ay());
Networkstream.Write(Data_,0,Data_.Length);
string temp=read_single_line_response();
---------------------------
The stack trace is this:
---------------------------
See the end of this message for details on invoking
just-in-time (JIT) debugging instead of this dialog box.

************** Exception Text **************
System.IO.IOException: Unable to read data from the transport connection.
---> System.Net.Sockets.SocketException: Se ha forzado la interrupcion de
una
conexion existente por el host remoto
at System.Net.Sockets.Socket.Receive(Byte[] buffer, Int32 offset, Int32
size, SocketFlags socketFlags)
at System.Net.Sockets.NetworkStream.Read(Byte[] buffer, Int32 offset,
Int32 size)
--- End of inner exception stack trace ---
at System.Net.Sockets.NetworkStream.Read(Byte[] buffer, Int32 offset,
Int32 size)
at System.IO.StreamReader.ReadBuffer()
at System.IO.StreamReader.ReadLine()
at GmailParser.Emailer.read_single_line_response() in c:\documents and
settings\alpha1\escritorio\gmailparsers\emailer.cs :line 148
at GmailParser.Emailer.USER() in c:\documents and
settings\alpha1\escritorio\gmailparsers\emailer.cs :line 101
at GmailParser.Emailer.Connect() in c:\documents and
settings\alpha1\escritorio\gmailparsers\emailer.cs :line 50
at GmailParser.Form1.Form1_Load(Object sender, EventArgs e) in
C:\Documents and Settings\Alpha1\Escritorio\GmailParsers\Form1.cs:l ine 78
at System.Windows.Forms.Form.OnLoad(EventArgs e)
at System.Windows.Forms.Form.OnCreateControl()
at System.Windows.Forms.Control.CreateControl(Boolean fIgnoreVisible)
at System.Windows.Forms.Control.CreateControl()
at System.Windows.Forms.Control.WmShowWindow(Message& m)
at System.Windows.Forms.Control.WndProc(Message& m)
at System.Windows.Forms.ScrollableControl.WndProc(Mes sage& m)
at System.Windows.Forms.ContainerControl.WndProc(Mess age& m)
at System.Windows.Forms.Form.WmShowWindow(Message& m)
at System.Windows.Forms.Form.WndProc(Message& m)
at System.Windows.Forms.ControlNativeWindow.OnMessage (Message& m)
at System.Windows.Forms.ControlNativeWindow.WndProc(M essage& m)
at System.Windows.Forms.NativeWindow.Callback(IntPtr hWnd, Int32 msg,
IntPtr wparam, IntPtr lparam)
************** Loaded Assemblies **************
mscorlib
Assembly Version: 1.0.5000.0
Win32 Version: 1.1.4322.573
CodeBase:
file:///c:/windowss/microsoft.net/framework/v1.1.4322/mscorlib.dll
----------------------------------------
GmailParser
Assembly Version: 1.0.2173.39969
Win32 Version: 1.0.2173.39969
CodeBase:
file:///C:/Documents%20and%20Settings/Alpha1/Escritorio/GmailParsers/bin/Debug/GmailParser.exe
----------------------------------------
System.Windows.Forms
Assembly Version: 1.0.5000.0
Win32 Version: 1.1.4322.573
CodeBase:
file:///c:/windowss/assembly/gac/system.windows.forms/1.0.5000.0__b77a5c561934e089/system.windows.forms.dll
----------------------------------------
System
Assembly Version: 1.0.5000.0
Win32 Version: 1.1.4322.573
CodeBase:
file:///c:/windowss/assembly/gac/system/1.0.5000.0__b77a5c561934e089/system.dll
----------------------------------------
System.Drawing
Assembly Version: 1.0.5000.0
Win32 Version: 1.1.4322.573
CodeBase:
file:///c:/windowss/assembly/gac/system.drawing/1.0.5000.0__b03f5f7f11d50a3a/system.drawing.dll
----------------------------------------
System.Xml
Assembly Version: 1.0.5000.0
Win32 Version: 1.1.4322.573
CodeBase:
file:///c:/windowss/assembly/gac/system.xml/1.0.5000.0__b77a5c561934e089/system.xml.dll
----------------------------------------

************** JIT Debugging **************
To enable just in time (JIT) debugging, the config file for this
application or machine (machine.config) must have the
jitDebugging value set in the system.windows.forms section.
The application must also be compiled with debugging
enabled.

For example:

<configuration>
<system.windows.forms jitDebugging="true" />
</configuration>

When JIT debugging is enabled, any unhandled exception
will be sent to the JIT debugger registered on the machine
rather than being handled by this dialog.
--
Thanks
Regards.
Josema

Dec 13 '05 #2
port 995 for POP3 Gmail is using SSL. I hope thats not causing the
issue.

Dec 14 '05 #3
Thanks a lot Vadym, i will try first to use only Network Stream, and the Can
Read property...

--
Thanks
Regards.
Josema
"Vadym Stetsyak" wrote:
you can check stream CanRead property before reading from it
why do you create StreamReader? you can read directly from network stream

Also notice that StreamReader is inherited from TextReader and NetworkStream
from Stream

--
Vadym Stetsyak aka Vadmyst
http://vadmyst.blogspot.com

"Josema" <Je******@ocu.org> wrote in message
news:4D**********************************@microsof t.com...
Hi to all,

Im searching a hand to solve an Exception that i get when i try to give
the
user to a gmail account...

Any help would be appreciated.. Thanks in advance

This is a piece of my code:

Server=new TcpClient("pop.gmail.com",995); //stablish a connection

Networkstream=Server.GetStream();//returns the first stream

Readerstream=new StreamReader(Server.GetStream());

username="xx*******@gmail.com";
string Data= "USER "+username + CRLF;
byte[] Data_ =
System.Text.Encoding.ASCII.GetBytes(Data.ToCharArr ay());
Networkstream.Write(Data_,0,Data_.Length);
string temp=read_single_line_response();
---------------------------
The stack trace is this:
---------------------------
See the end of this message for details on invoking
just-in-time (JIT) debugging instead of this dialog box.

************** Exception Text **************
System.IO.IOException: Unable to read data from the transport connection.
---> System.Net.Sockets.SocketException: Se ha forzado la interrupcion de
una
conexion existente por el host remoto
at System.Net.Sockets.Socket.Receive(Byte[] buffer, Int32 offset, Int32
size, SocketFlags socketFlags)
at System.Net.Sockets.NetworkStream.Read(Byte[] buffer, Int32 offset,
Int32 size)
--- End of inner exception stack trace ---
at System.Net.Sockets.NetworkStream.Read(Byte[] buffer, Int32 offset,
Int32 size)
at System.IO.StreamReader.ReadBuffer()
at System.IO.StreamReader.ReadLine()
at GmailParser.Emailer.read_single_line_response() in c:\documents and
settings\alpha1\escritorio\gmailparsers\emailer.cs :line 148
at GmailParser.Emailer.USER() in c:\documents and
settings\alpha1\escritorio\gmailparsers\emailer.cs :line 101
at GmailParser.Emailer.Connect() in c:\documents and
settings\alpha1\escritorio\gmailparsers\emailer.cs :line 50
at GmailParser.Form1.Form1_Load(Object sender, EventArgs e) in
C:\Documents and Settings\Alpha1\Escritorio\GmailParsers\Form1.cs:l ine 78
at System.Windows.Forms.Form.OnLoad(EventArgs e)
at System.Windows.Forms.Form.OnCreateControl()
at System.Windows.Forms.Control.CreateControl(Boolean fIgnoreVisible)
at System.Windows.Forms.Control.CreateControl()
at System.Windows.Forms.Control.WmShowWindow(Message& m)
at System.Windows.Forms.Control.WndProc(Message& m)
at System.Windows.Forms.ScrollableControl.WndProc(Mes sage& m)
at System.Windows.Forms.ContainerControl.WndProc(Mess age& m)
at System.Windows.Forms.Form.WmShowWindow(Message& m)
at System.Windows.Forms.Form.WndProc(Message& m)
at System.Windows.Forms.ControlNativeWindow.OnMessage (Message& m)
at System.Windows.Forms.ControlNativeWindow.WndProc(M essage& m)
at System.Windows.Forms.NativeWindow.Callback(IntPtr hWnd, Int32 msg,
IntPtr wparam, IntPtr lparam)
************** Loaded Assemblies **************
mscorlib
Assembly Version: 1.0.5000.0
Win32 Version: 1.1.4322.573
CodeBase:
file:///c:/windowss/microsoft.net/framework/v1.1.4322/mscorlib.dll
----------------------------------------
GmailParser
Assembly Version: 1.0.2173.39969
Win32 Version: 1.0.2173.39969
CodeBase:
file:///C:/Documents%20and%20Settings/Alpha1/Escritorio/GmailParsers/bin/Debug/GmailParser.exe
----------------------------------------
System.Windows.Forms
Assembly Version: 1.0.5000.0
Win32 Version: 1.1.4322.573
CodeBase:
file:///c:/windowss/assembly/gac/system.windows.forms/1.0.5000.0__b77a5c561934e089/system.windows.forms.dll
----------------------------------------
System
Assembly Version: 1.0.5000.0
Win32 Version: 1.1.4322.573
CodeBase:
file:///c:/windowss/assembly/gac/system/1.0.5000.0__b77a5c561934e089/system.dll
----------------------------------------
System.Drawing
Assembly Version: 1.0.5000.0
Win32 Version: 1.1.4322.573
CodeBase:
file:///c:/windowss/assembly/gac/system.drawing/1.0.5000.0__b03f5f7f11d50a3a/system.drawing.dll
----------------------------------------
System.Xml
Assembly Version: 1.0.5000.0
Win32 Version: 1.1.4322.573
CodeBase:
file:///c:/windowss/assembly/gac/system.xml/1.0.5000.0__b77a5c561934e089/system.xml.dll
----------------------------------------

************** JIT Debugging **************
To enable just in time (JIT) debugging, the config file for this
application or machine (machine.config) must have the
jitDebugging value set in the system.windows.forms section.
The application must also be compiled with debugging
enabled.

For example:

<configuration>
<system.windows.forms jitDebugging="true" />
</configuration>

When JIT debugging is enabled, any unhandled exception
will be sent to the JIT debugger registered on the machine
rather than being handled by this dialog.
--
Thanks
Regards.
Josema


Dec 14 '05 #4
Hi tdavisjr,

I only found in this url
(http://mail.google.com/support/bin/a...y?answer=13276) the port 995 for
the pop3....

Yes, as you say is for SSL, but what do you think about which port may i
use, to do that?? Do you know the number?

--
Thanks
Regards.
Josema
"tdavisjr" wrote:
port 995 for POP3 Gmail is using SSL. I hope thats not causing the
issue.

Dec 14 '05 #5

This discussion thread is closed

Replies have been disabled for this discussion.

Similar topics

By using this site, you agree to our Privacy Policy and Terms of Use.