Home | Contact Us | FAQ | Search & Site Map | Link to Us
Sign In | Join | Other 45 Sites in Network
HomeAnnouncementsFree MagazinesWhite PapersSubmit Content
Discussion GroupsASP.NETWindows FormsLanguages.NET FrameworkVisual Studio.NET
Articles.NET FrameworkASP.NETToolsWindows Forms
.NET DirectoryOpen Source ProjectsUser GroupsWeb Resources
Related Topics
Visual Basic 6SQL ServerMS AccessOther DB ProductsMS Server ProductsMore Topics ...

.NET Forum / .NET Framework / New Users / August 2007

Tip: Looking for answers? Try searching our database.

error while retrieving values from socket

Thread view: 
Enable EMail Alerts  Start New Thread
Thread rating: 
cmrhema - 11 Aug 2007 11:42 GMT
Hello,

We are currently using a program where we recieve the details from the
client. Developed in C#.It is recieved through sockets.
It is working fine. i.e. When we start the program afresh we do get
details properly. We recieve the data as strings and we store in a list
box.But after two or three days we have an error stating as below

System.NullReferenceException: Object reference not set to an instance
of an object.
at System.Windows.Forms.ListBox.ItemArray.IndexOf(Obj ect item, Int32
stateMask)
at System.Windows.Forms.ListBox.ObjectCollection.AddI nternal(Object
item)
at System.Windows.Forms.ListBox.ObjectCollection.Add( Object item)
at StepIIServer.Server.RunClient2() in E:\stepII\Server.cs:line 346
8/7/2007 8:19:26 PM Error :$<MSG.Info.ServerLogin>
$DeviceName=352022000365427
$Software=steppII_2.4.3_final
$Hardware=STEPPII-55
$LastValidPosition=$GPRMC,145245.573,A,2941.6635,N
,07659.7630,E,0.00,2.34,070807,,
$IMEI=352022000365427
$PhoneNumber=
$LocalIP=555.36.20.147
$CmdVersion=2
$SUCCESS
$<end>
&IMEI=352022000365427,Distance=63936,
&GPRMC,145240.574,A,2941.6635,N,07659.7630,E,0.00,2 .34,070807,,
<end>

and another error stating
ping
System.Net.Sockets.SocketException: An existing connection was forcibly
closed by the remote host
at System.Net.Sockets.Socket.Receive(Byte[] buffer, Int32 offset, Int32
size, SocketFlags socketFlags)
at System.Net.Sockets.Socket.Receive(Byte[] buffer)
at StepIIServer.Server.RunClient2() in E:\stepII\Server.cs:line 288
8/7/2007 5:51:34 AM Error :&IMEI=352022000370849,Distance=1487,
&GPRMC,001830.515,A,2943.0151,N,07658.9818,E,0.00,8 .79,070807,,
<end>

Will you please help

thanks
Hema
Peter Duniho - 11 Aug 2007 18:44 GMT
> Hello,
>
[quoted text clipped - 3 lines]
> details properly. We recieve the data as strings and we store in a list
> box.But after two or three days we have an error stating as below

You didn't post any code, so the best anyone can do is guess.  My guess
is this: you have a valid socket error (connection was reset, generating
the one socket exception), which somehow results in you attempting to
add a null string reference to your list box (generating the
NullReferenceException).

Fix your socket error handling so that it catches the reset connection
exception and doesn't try to add a null reference to the ListBox, and I
would guess the NullReferenceException will go away.  You'll still get
the SocketException, but since you'll be handling it, that's okay.

Pete

Free Magazines

Get these publications absolutely FREE for up to 12 months. There are no hidden fees and no obligation. Simply choose a title, complete the application form and submit it. Read more ...

Oracle MagazineNetwork ComputingComputer WorldBio-IT WorldeWeekInformation WeekInfosecurity
 
Sign In
Join
My Latest Posts
My Monitored Threads
My Blog
My Photo Gallery
My Profile
My Homepage

Start New Thread
Enable EMail Alerts
Rate this Thread



©2008 Advenet LLC   Privacy Policy - Terms of Use
This website includes both content owned or controlled by Advenet as well as content owned or controlled by third parties.