473,224 Members | 1,738 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,224 software developers and data experts.

Networkstream returns ArgumentOutOfRangeException

Since this issue encompasses so many things - I have to generally post it I
guess.

I'm building an application for a Wireless PDA - when it is connected to the
Network I tested a TCPListener & TCPClient connection from the Server to the
PDA. The connection allows me to Send from the PDA to the Server - but the
PDA will not read what the Server writes. I copied the exact information from
Microsofts Website on TCP basics - with some changes. Even disabled Firewall
Security - same. The PDA will download webpages, the Server can ping it - but
it will not receive.

Its an HP iPAQ rx3100 if that matters with Windows CE 4.2 2003 - Server is
running Windows 2003 Standard - and I am using Visual Studio 2003.NET to test
- the PDA also has OpenNETCF 1.2 with /cfAES pack.
Jul 21 '05 #1
7 2343
Dustin B <Du*****@discussions.microsoft.com> wrote:
Since this issue encompasses so many things - I have to generally post it I
guess.

I'm building an application for a Wireless PDA - when it is connected to the
Network I tested a TCPListener & TCPClient connection from the Server to the
PDA. The connection allows me to Send from the PDA to the Server - but the
PDA will not read what the Server writes. I copied the exact information from
Microsofts Website on TCP basics - with some changes. Even disabled Firewall
Security - same. The PDA will download webpages, the Server can ping it - but
it will not receive.

Its an HP iPAQ rx3100 if that matters with Windows CE 4.2 2003 - Server is
running Windows 2003 Standard - and I am using Visual Studio 2003.NET to test
- the PDA also has OpenNETCF 1.2 with /cfAES pack.


You haven't said exactly what happens, or posted any code.

Could you post a short but complete program which demonstrates the
problem?

See http://www.pobox.com/~skeet/csharp/complete.html for details of
what I mean by that.

--
Jon Skeet - <sk***@pobox.com>
http://www.pobox.com/~skeet
If replying to the group, please do not mail me too
Jul 21 '05 #2


"Jon Skeet [C# MVP]" wrote:
Dustin B <Du*****@discussions.microsoft.com> wrote:
Since this issue encompasses so many things - I have to generally post it I
guess.

I'm building an application for a Wireless PDA - when it is connected to the
Network I tested a TCPListener & TCPClient connection from the Server to the
PDA. The connection allows me to Send from the PDA to the Server - but the
PDA will not read what the Server writes. I copied the exact information from
Microsofts Website on TCP basics - with some changes. Even disabled Firewall
Security - same. The PDA will download webpages, the Server can ping it - but
it will not receive.

Its an HP iPAQ rx3100 if that matters with Windows CE 4.2 2003 - Server is
running Windows 2003 Standard - and I am using Visual Studio 2003.NET to test
- the PDA also has OpenNETCF 1.2 with /cfAES pack.


You haven't said exactly what happens, or posted any code.

Could you post a short but complete program which demonstrates the
problem?

See http://www.pobox.com/~skeet/csharp/complete.html for details of
what I mean by that.

--
Jon Skeet - <sk***@pobox.com>
http://www.pobox.com/~skeet
If replying to the group, please do not mail me too


Server
-------
Dim TcpC as New TcpListener(IPAddress.Parse("192.168.1.5"), 8500)
TcpC.Start()

Dim tcpclient as TcpClient = TcpC.AcceptTcpClient
Dim ns as NetworkStream = tcpclient.GetStream
Dim bytes() as Byte
bytes = System.Text.Encoding.ASCII.GetBytes("Testing Connection Write")
ns.Write(bytes, 0, bytes.length)
tcpclient.Close()
TcpC.Stop()
Client
------
Dim tcpc As New TcpClient
tcpc.Connect(IPAddress.Parse("192.168.1.5"), 8500)
Dim bytes(30000) As Byte
Dim NS As NetworkStream = tcpc.GetStream
NS.Read(bytes, 0, CInt(tcpc.ReceiveBufferSize))

bytes returns as IsNothing(bytes) = True
Jul 21 '05 #3
Dustin B <Du*****@discussions.microsoft.com> wrote:
Server
-------
Dim TcpC as New TcpListener(IPAddress.Parse("192.168.1.5"), 8500)
TcpC.Start()

Dim tcpclient as TcpClient = TcpC.AcceptTcpClient
Dim ns as NetworkStream = tcpclient.GetStream
Dim bytes() as Byte
bytes = System.Text.Encoding.ASCII.GetBytes("Testing Connection Write")
ns.Write(bytes, 0, bytes.length)
tcpclient.Close()
TcpC.Stop()
Client
------
Dim tcpc As New TcpClient
tcpc.Connect(IPAddress.Parse("192.168.1.5"), 8500)
Dim bytes(30000) As Byte
Dim NS As NetworkStream = tcpc.GetStream
NS.Read(bytes, 0, CInt(tcpc.ReceiveBufferSize))

bytes returns as IsNothing(bytes) = True


Please read
http://www.pobox.com/~skeet/csharp/incomplete.html

--
Jon Skeet - <sk***@pobox.com>
http://www.pobox.com/~skeet
If replying to the group, please do not mail me too
Jul 21 '05 #4


"Jon Skeet [C# MVP]" wrote:
Dustin B <Du*****@discussions.microsoft.com> wrote:
Server
-------
Dim TcpC as New TcpListener(IPAddress.Parse("192.168.1.5"), 8500)
TcpC.Start()

Dim tcpclient as TcpClient = TcpC.AcceptTcpClient
Dim ns as NetworkStream = tcpclient.GetStream
Dim bytes() as Byte
bytes = System.Text.Encoding.ASCII.GetBytes("Testing Connection Write")
ns.Write(bytes, 0, bytes.length)
tcpclient.Close()
TcpC.Stop()
Client
------
Dim tcpc As New TcpClient
tcpc.Connect(IPAddress.Parse("192.168.1.5"), 8500)
Dim bytes(30000) As Byte
Dim NS As NetworkStream = tcpc.GetStream
NS.Read(bytes, 0, CInt(tcpc.ReceiveBufferSize))

bytes returns as IsNothing(bytes) = True


Please read
http://www.pobox.com/~skeet/csharp/incomplete.html

--
Jon Skeet - <sk***@pobox.com>
http://www.pobox.com/~skeet
If replying to the group, please do not mail me too


I am serious that's it. On the last line of the Client Script it returns the
ArgumentOutOfRangeException - the most I can figure is that the byte array
when returned is empty - however the Client does say there is Data Available.
I have two version the full one - not shown - and the test one (shown) both
return the same error. I have had the PDA unplugged from ActiveSync to test -
tested the Firewall/Router rewired the Network - nothing same error. I'm
almost tempted to think its hardware or another layer of the PDA but the PDA
is able to write to the stream if I swap the Client/Listener Read/Write
commands.
Jul 21 '05 #5
Dustin B <Du*****@discussions.microsoft.com> wrote:
Please read
http://www.pobox.com/~skeet/csharp/incomplete.html
I am serious that's it.


No it's not. You didn't post a complete program. If you don't believe
me, try cutting and pasting your code into an empty text editor, and
then compiling it without adding anything more.
On the last line of the Client Script it returns the
ArgumentOutOfRangeException


And what's the message of the ArgumentOutOfRangeException? It should at
least tell you what argument it is that's out of range.

--
Jon Skeet - <sk***@pobox.com>
http://www.pobox.com/~skeet
If replying to the group, please do not mail me too
Jul 21 '05 #6


"Jon Skeet [C# MVP]" wrote:
Dustin B <Du*****@discussions.microsoft.com> wrote:
Please read
http://www.pobox.com/~skeet/csharp/incomplete.html


I am serious that's it.


No it's not. You didn't post a complete program. If you don't believe
me, try cutting and pasting your code into an empty text editor, and
then compiling it without adding anything more.
On the last line of the Client Script it returns the
ArgumentOutOfRangeException


And what's the message of the ArgumentOutOfRangeException? It should at
least tell you what argument it is that's out of range.

--
Jon Skeet - <sk***@pobox.com>
http://www.pobox.com/~skeet
If replying to the group, please do not mail me too

Well I took out the silly stuff like Imports and Sub New - but that was all
autocreated by VS.NET anyway. It never told me what the Argument was. But I
just found the solution anyway. Seems that it was being thrown by the
NetworkStream itself.

NetworkStream.Read(bytes as Byte[], position (as Integer), length (as
Integer)) as Integer

only after some digging did I notice the return at the end - as soon as I
captured the return somewhere - the String sent along the stream was
captured. Strange.
Jul 21 '05 #7
Dustin B <Du*****@discussions.microsoft.com> wrote:
I am serious that's it.
No it's not. You didn't post a complete program. If you don't believe
me, try cutting and pasting your code into an empty text editor, and
then compiling it without adding anything more.
On the last line of the Client Script it returns the
ArgumentOutOfRangeException


And what's the message of the ArgumentOutOfRangeException? It should at
least tell you what argument it is that's out of range.

Well I took out the silly stuff like Imports and Sub New - but that was all
autocreated by VS.NET anyway.


That's not silly stuff. It makes life *much* easier for someone to
reproduce the problem. I don't want to have to launch Visual Studio in
order to test your code - I want to be able to copy your code into a
text editor, compile it and run it. If it's going to take longer than
that, I'll move onto a message where someone is willing to follow
instructions to make it easier for me to help them - that way I get to
help more people.
It never told me what the Argument was.
Not in the message? Was there a message at all? You never posted it.
But I just found the solution anyway. Seems that it was being thrown
by the NetworkStream itself.

NetworkStream.Read(bytes as Byte[], position (as Integer), length (as
Integer)) as Integer

only after some digging did I notice the return at the end - as soon as I
captured the return somewhere - the String sent along the stream was
captured. Strange.


I don't see how using the return value could affect things at all. But
without a short but complete test program, I'm not going to bother to
investigate further...

--
Jon Skeet - <sk***@pobox.com>
http://www.pobox.com/~skeet
If replying to the group, please do not mail me too
Jul 21 '05 #8

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

3
by: Darcy Ryan | last post by:
Greetings, I am having a problem trying to use the TcpClient and NetworkStream classes to connect to a POP3 server. My (simplified test) VB.NET code is as follows: Dim tcpclient As New...
4
by: 0to60 | last post by:
I have a class that wraps a TcpClient object and manages all the async reading of the socket. It works really nice, and I use it all over the place. But there's this ONE INSTANCE where I create...
0
by: Hai Ly Hoang \(MT00KSTN\) | last post by:
Hi, FileStream.Read(buf, offset, siz) will return when reaching the end of file or a block (size siz) can be read from the file. In the case of NetworkStream, it's more confusing. Now, consider...
2
by: Srinivas R. Loka | last post by:
I have a TCP server to which a number of mobile devices connect. If a device disconnects(mostly no clean close as they usually lose cell coverage or shutdown), and the server then tries to send...
10
by: Sven Huijbrechts | last post by:
Hello, I need to send a couple of "NUL"s -> HEX value "00" on a networkstream.. This is the code we currently use to send string: Dim sendBytes As () =...
2
by: Dustin Brisebois via DotNetMonster.com | last post by:
This is coming from a Windows 2003 Server to a HP Pocket PC (WinCE 2003) over 802.11b. The device is on the Network and can be pinged, it can write data to the Server stream - but not read the...
7
by: Dustin B | last post by:
Since this issue encompasses so many things - I have to generally post it I guess. I'm building an application for a Wireless PDA - when it is connected to the Network I tested a TCPListener &...
0
by: Al Wilkerson | last post by:
Hey, Has anyone ever got a "Unable to read data from transport connected" message after reading data from a streamreader composed of a networkstream. For example: Server TcpListener...
8
by: Peter Bradley | last post by:
Hi, I wonder if anyone can help me out? I'm trying to implement an EPP (rfc4934 and rfc4930) client. So far I've managed to connect and authorise using an X509 Certificate. This should...
1
isladogs
by: isladogs | last post by:
The next online meeting of the Access Europe User Group will be on Wednesday 6 Dec 2023 starting at 18:00 UK time (6PM UTC) and finishing at about 19:15 (7.15PM). In this month's session, Mike...
0
by: VivesProcSPL | last post by:
Obviously, one of the original purposes of SQL is to make data query processing easy. The language uses many English-like terms and syntax in an effort to make it easy to learn, particularly for...
0
by: abbasky | last post by:
### Vandf component communication method one: data sharing ​ Vandf components can achieve data exchange through data sharing, state sharing, events, and other methods. Vandf's data exchange method...
2
isladogs
by: isladogs | last post by:
The next Access Europe meeting will be on Wednesday 7 Feb 2024 starting at 18:00 UK time (6PM UTC) and finishing at about 19:30 (7.30PM). In this month's session, the creator of the excellent VBE...
0
by: fareedcanada | last post by:
Hello I am trying to split number on their count. suppose i have 121314151617 (12cnt) then number should be split like 12,13,14,15,16,17 and if 11314151617 (11cnt) then should be split like...
0
by: stefan129 | last post by:
Hey forum members, I'm exploring options for SSL certificates for multiple domains. Has anyone had experience with multi-domain SSL certificates? Any recommendations on reliable providers or specific...
0
Git
by: egorbl4 | last post by:
Скачал я git, хотел начать настройку, а там вылезло вот это Что это? Что мне с этим делать? ...
1
by: davi5007 | last post by:
Hi, Basically, I am trying to automate a field named TraceabilityNo into a web page from an access form. I've got the serial held in the variable strSearchString. How can I get this into the...
0
by: MeoLessi9 | last post by:
I have VirtualBox installed on Windows 11 and now I would like to install Kali on a virtual machine. However, on the official website, I see two options: "Installer images" and "Virtual machines"....

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.