|
Try importing the System.Windows.Forms DLL?
Will make your class library ALOT bigger, yet it will work
I had the same issue whilst attempting to create custom Paint events in my DLL
-= Reelix =-
|
|
|
|
|
Say i have a server running and several client connected to this server. How to program
1)to detect when a client on purpose power down his PC without closing the connection
2)the client's pc hang causing connection to server be disconnected
Thanks in advance
|
|
|
|
|
One possible way is to keep some table to track the last activity time of each client. If it is more than some acceptable window we could assume there is something went wrong with the client.
Thanks
Laddie
Kindly rate if the answer was helpful
|
|
|
|
|
what will be the best timing to consider a connection has broken
|
|
|
|
|
It is a matter of what your application does...You will have to figure it out but taking into consideration the the frequencey in which the client communicates to the server.
Thanks
Laddie
Kindly rate if the answer was helpful
|
|
|
|
|
loke6258038 wrote: to detect when a client on purpose power down his PC without closing the connection
There is no way to detect a client connection dropped without trying to contact it. If you write both client and server, you could implement some sort of "ping" or "heartbeat" functionality.
|
|
|
|
|
But the contacting the client from the server will not work if they are in different network where the ports are opened from only one side.Which will probably the typical case.
Thanks
Laddie
Kindly rate if the answer was helpful
|
|
|
|
|
If you are concerned with the client dropping the connection, this means that once the connection is opened, you can talk to the client.
I don't know the protocol you use, but I suspect it is custom. So, in your communication protocol, you could add a call where the server asks the client if he is still there after some idle time.
|
|
|
|
|
When you are closing the connection i.e when the user at the client closes the application call a function and indicate the server that the client is closing normally, on the form close method (if it is a winform) communicate to the server saying forced application close. You need to handle form close carefully because even under normal application close form close method gets triggered (this can be handled).
|
|
|
|
|
Hi,
In order to catch all cases, I would suggest a heartbeat function (as was already suggested). Some details (drawn from specs I've encountered interfacing with various industrial PLC systems):
- If your client sessions don't use persistent TCP connections (if you are using an HTTP request for each transaction, for example), you're correct in noting that you can't contact the client from the server gratuitously. In that case, have the client contact the server with a dummy message with a specific interval (unless it has already talked to the server during the interval) and let the server invalidate sessions that haven't been heard from in, say, twice that interval.
- If you do use persistent TCP connections (that stay open for the duration of the client session) you can contact the clients from the server (you can write to the socket from either direction as long as it's open). You could then send an "are you alive?"-message to clients you hadn't heard from in a while - you will get an exception if the TCP/IP stack has given up on the connection, a response if not and the client is alive, no response if the client is dead but the TCP/IP stack hasn't realized it yet. The benefit of this is that you can tune the timer intervals on the server without having to change or inform the clients.
Reasonable interval would be application specific, but beware of swamping the server with keep-alives if you could have a lot of clients.
One crane controller protocol I use requires keepalives be sent each minute (by both ends) and any party that hasn't heard anything for two minutes closes and gives up on the connection (if it's the client that gives up, it starts attempting to reconnect to the server - this also has a timeout and will be repeated indefinitely, as the protocol is built for stuff that should be connected at all times). Persistent TCP connections are used here.
Useful?
--
Peter
|
|
|
|
|
Thanks Peter..It is a good note.
Thanks
Laddie
Kindly rate if the answer was helpful
|
|
|
|
|
|
Look[^] what I found with google !!!
Christian Graus
Please read this if you don't understand the answer I've given you
"also I don't think "TranslateOneToTwoBillion OneHundredAndFortySevenMillion FourHundredAndEightyThreeThousand SixHundredAndFortySeven()" is a very good choice for a function name" - SpacixOne ( offering help to someone who really needed it ) ( spaces added for the benefit of people running at < 1280x1024 )
|
|
|
|
|
I suggest that Chris implements a functionality where every time a new post is made on aprogramming forum there is an automatic reply telling the poster to do a search on Google.
|
|
|
|
|
|
yes .. i would like to use OLEDB data provider
csetopper_bhanu
|
|
|
|
|
Thanx dude
csetopper_bhanu
|
|
|
|
|
|
|
Learn a programming language, learn the associated libraries and frameworks, design the application and then make the application.
|
|
|
|
|
I guess you write some code that contains all the items that need to go in the time table, then somehow works out a way to organise those items so they don't clash.
If this is homework, then we would not be helping you if we did it for you. If this is paid work, why should you get paid if you're incapable of doing the work on the most basic level ? Come back when you've tried to do this yourself, and we'd love to offer more specific help.
Christian Graus
Please read this if you don't understand the answer I've given you
"also I don't think "TranslateOneToTwoBillion OneHundredAndFortySevenMillion FourHundredAndEightyThreeThousand SixHundredAndFortySeven()" is a very good choice for a function name" - SpacixOne ( offering help to someone who really needed it ) ( spaces added for the benefit of people running at < 1280x1024 )
|
|
|
|
|
|
James Bond is a spy, not a detective. So to qualify you would have to bug him and stealthily observe him doing his ECE.
|
|
|
|
|
What is up with all the deleted posts? Maybe "James Bond" can figure that out??
Excellence is doing ordinary things extraordinarily well.
|
|
|
|
|
Hi,
I am writing a code in c# with asp.net 2003 for export to excel from Repeater Control.In this I am facing file size is very big than normal.It has 5000 rows also 120 Columns.In these around 60 Columns are containing text class(style Sheet).I got exported file size is 32 MB.But if I copy those rows from exported file and paste it into new file , the new file has only 5.2 MB.Even If i open the exported file and save as new copy ,Its also contains 5.2 MB only. How to Reduce my file size while exporting only.My code is
<br />
string strFilePath="";<br />
DateTime tTime = DateTime.Now;<br />
strFilePath = "ADSL"+tTime + ".xls";<br />
strFilePath = strFilePath.Replace("/","");<br />
strFilePath = strFilePath.Replace(" ","");<br />
strFilePath = strFilePath.Replace(":","");<br />
string serverpath = Request.PhysicalApplicationPath.ToString();<br />
serverpath += @"ExcelFiles\";<br />
if (!Directory.Exists(serverpath))<br />
{<br />
Directory.CreateDirectory(serverpath);<br />
}<br />
serverpath += strFilePath;<br />
string style = @"<style> .text { mso-number-format:\@; } </style> ";<br />
Repeater1.Items[0].Visible = true;<br />
Response.Clear(); <br />
Response.AddHeader("content-disposition", "attachment;filename=" +serverpath);<br />
Response.ContentType = "application/vnd.ms-excel";<br />
System.IO.StringWriter stringWrite = new System.IO.StringWriter();<br />
System.Web.UI.HtmlTextWriter htmlWrite = new HtmlTextWriter(stringWrite);<br />
Repeater1.RenderControl(htmlWrite);<br />
Response.Write(style);<br />
Response.Write(stringWrite.ToString());<br />
Response.End();<br />
If anyone knows answers, Plz reply fast.This is urgent
Regards
prabu
|
|
|
|