Click here to Skip to main content
15,914,327 members
Home / Discussions / C#
   

C#

 
GeneralRe: DataSet in Parent Form - DataBinding from Child UserControl's Pin
Heath Stewart13-Apr-04 2:48
protectorHeath Stewart13-Apr-04 2:48 
QuestionHow to do this OnPaint Event ?(about remote screen transmit) Pin
fu011-Apr-04 2:16
fu011-Apr-04 2:16 
AnswerRe: How to do this OnPaint Event ?(about remote screen transmit) Pin
leppie11-Apr-04 3:24
leppie11-Apr-04 3:24 
AnswerRe: How to do this OnPaint Event ?(about remote screen transmit) Pin
DrGreen12-Apr-04 10:46
DrGreen12-Apr-04 10:46 
GeneralTrayAutoArrange - please help! Pin
Anonymous11-Apr-04 0:43
Anonymous11-Apr-04 0:43 
GeneralImage - help me please Pin
Moon Boy10-Apr-04 21:34
Moon Boy10-Apr-04 21:34 
GeneralRe: Image - help me please Pin
Jay Shankar11-Apr-04 15:28
Jay Shankar11-Apr-04 15:28 
GeneralSocket Connection Pin
dabuskol10-Apr-04 20:33
dabuskol10-Apr-04 20:33 
Hi Guys,

I've created a program in c# that reads data from different port at the same time - so far it was ok connection to 5 ports at the same time using sockets. My concern now is if the administrator from one of the ports "KILL" or "TERMINATE" that particular port my program doesn't catch it. I'm using socketexcetopn as my CATCH and at the same time ObjectDisposedException still no luck. If you run NETSTAT from "cmd" you can see that the connection is "CLOSE_WAIT". What happen is that the connection will always be there. My program is running on 24hrs everyday.
I need to monitor that becuase if it's disconnected I need to reconnect it again.

CODE:

socketList[arrcnt] = new Socket(AddressFamily.InterNetwork,SocketType.Stream ,ProtocolType.Tcp );
IPAddress ip = IPAddress.Parse (stripd);
Int32 iPortNo = System.Convert.ToInt32 ( strport);
IPEndPoint ipEnd = new IPEndPoint(ip.Address, iPortNo);
socketList[arrcnt].Connect (ipEnd);
WaitForData(socketList[arrcnt]);

CSocketPacket theSockId = (CSocketPacket)asyn.AsyncState ;
try
{
//end receive...
int iRx = 0 ;
iRx = theSockId.thisSocket.EndReceive (asyn);
if (theSockId.dataBuffer == null)
{
int sam = System.Environment.TickCount;
}

char[] chars = new char[iRx]; // + 1];
System.Text.Decoder d = System.Text.Encoding.ASCII.GetDecoder();
int charLen = d.GetChars(theSockId.dataBuffer, 0, iRx, chars, 0);
StringBuilder szData = new StringBuilder();
szData.Append(chars);
WaitForData(theSockId.thisSocket);
}
catch (ObjectDisposedException)
{}
catch(SocketException se)
{System.Diagnostics.EventLog.WriteEntry("ossrop on datareceived",theSockId.thisSocket.RemoteEndPoint.ToString() + " " + se.Message);
}

Any help or explanation will do. Thanks in advance.
Cool | :cool: /dabuskol
QuestionPocketPC, how to execute another app? Pin
waynerbruce10-Apr-04 19:32
waynerbruce10-Apr-04 19:32 
AnswerRe: PocketPC, how to execute another app? Pin
Mike Dimmick11-Apr-04 0:36
Mike Dimmick11-Apr-04 0:36 
GeneralRe: PocketPC, how to execute another app? Pin
waynerbruce11-Apr-04 20:27
waynerbruce11-Apr-04 20:27 
GeneralBinding Problem Pin
Jimbo45610-Apr-04 17:24
Jimbo45610-Apr-04 17:24 
GeneralRe: Binding Problem Pin
Jay Shankar11-Apr-04 16:05
Jay Shankar11-Apr-04 16:05 
GeneralRe: Binding Problem Pin
Jimbo45612-Apr-04 7:25
Jimbo45612-Apr-04 7:25 
GeneralRe: Binding Problem Pin
Jay Shankar12-Apr-04 21:41
Jay Shankar12-Apr-04 21:41 
GeneralKeypress WITHOUT textbox.. HELP Pin
pgfraz10-Apr-04 16:31
pgfraz10-Apr-04 16:31 
GeneralRe: Keypress WITHOUT textbox.. HELP Pin
MasudM10-Apr-04 19:30
MasudM10-Apr-04 19:30 
GeneralFileStream help! :( Pin
Moon Boy10-Apr-04 15:27
Moon Boy10-Apr-04 15:27 
GeneralFileStream help! :( Pin
moonboy10-Apr-04 15:27
moonboy10-Apr-04 15:27 
GeneralRe: FileStream help! :( Pin
Peter Nirschl10-Apr-04 21:20
Peter Nirschl10-Apr-04 21:20 
GeneralRe: FileStream help! :( Pin
moonboy10-Apr-04 21:24
moonboy10-Apr-04 21:24 
GeneralRe: FileStream help! :( Pin
Peter Nirschl10-Apr-04 21:38
Peter Nirschl10-Apr-04 21:38 
GeneralRe: FileStream help! :( Pin
Chad Smith11-Apr-04 9:30
professionalChad Smith11-Apr-04 9:30 
GeneralRe: FileStream help! :( Pin
amal_pro8311-Apr-04 9:57
amal_pro8311-Apr-04 9:57 
QuestionHow to Deploy windows application for only 15 days? Pin
KRathor10-Apr-04 12:10
KRathor10-Apr-04 12:10 

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.