|
faheemnadeem wrote: I can do some triggers on event logs so that winform application reacts immediately to reports from service, can i do this in xml?
You can write code that watches the XML file and when it is changed, reads and parses it. This will not be fast, you need to reparse all the data every time.
Christian Graus
Driven to the arms of OSX by Vista.
Read my blog to find out how I've worked around bugs in Microsoft tools and frameworks.
|
|
|
|
|
Same goes for the event logging method using eventlogs, triggers response is fairly random and has some delay, which is inherent to windows i think so.
takes 2-3 seconds on reply.
Any other faster solution!!!
|
|
|
|
|
You could try a SQL database, I guess.
Christian Graus
Driven to the arms of OSX by Vista.
Read my blog to find out how I've worked around bugs in Microsoft tools and frameworks.
|
|
|
|
|
You could loopback socket them...
The best way to accelerate a Macintosh is at 9.8m/sec² - Marcus Dolengo
|
|
|
|
|
I am making a TCP/IP server which is running as a service. The server listens for incoming client connections acquire data from them and inserts them into a private message queue.
All goes well!!!
Now what i am stuck at, is that i am making a server control GUI based application, which does some settings of this server for installing through an INI file, starts/stop, restarts etc and display some event logs which the service is currently generating. This one side communication also goes well.
The Problem
I wish to send some arguments/ data back to the service while its (running), like if i want to forcibly disconnect some client, so i send an ip:port to the service and does that for me.
i can use custom commands, but they don't take custom arguments. So i need is a simple as possible way to pass data to a service while its running.
And can i make a custom method in a service and access it from a service controller or by any other means.
Any help would be appreciated!!!
|
|
|
|
|
hi,
from where you want to give an input to the service...
i have an idea but not fare...
You can store the IP in local file and, you can read that from the service...
or
try to create some pipes( keep the values in memory itself)
|
|
|
|
|
well i want to provide the data dynamically from a winform application.
the data would be just some stings like i mentioned, ip port, which i require to disconnect client sockets. do some white listing, black listing etc.
Please can u be specific on the procedure, as i am a beginner programmer, so any code or article reference would be helpful.
+ a thing i thought was to make entries in a xml file, and use the custom command override in service to get data from there on user request. any other suggestion would be helpful.
|
|
|
|
|
You're writing a TCP server, as a windows service, and you're a beginner programmer ?
This is why stuff just works on the Mac.
faheemnadeem wrote: well i want to provide the data dynamically from a winform application.
If you want to provide changes on the fly, I'd imagine the service needs to provide the UI, or watch a config file to see if it gets changed by this other app.
Christian Graus
Driven to the arms of OSX by Vista.
Read my blog to find out how I've worked around bugs in Microsoft tools and frameworks.
|
|
|
|
|
i am beginner at some stuff and quite good at others :P
So i am not that in, in windows services...
So eventually the solution remains the same of reading a file.
humm...
|
|
|
|
|
That seems the easiest. You could have all sorts of inter process communication going on if you needed to, but why complicate things ?
Christian Graus
Driven to the arms of OSX by Vista.
Read my blog to find out how I've worked around bugs in Microsoft tools and frameworks.
|
|
|
|
|
Well Thanks Anyways,,,
I Think i will stick to this procedure then.
|
|
|
|
|
Dear all,
File download event does not happening in web browser.
please can some one help me what is the problem ?
my rough code is here bellow.
private SHDocVw.InternetExplorer browser;
browser.FileDownload += new DWebBrowserEvents2_FileDownloadEventHandler(browser_FileDownload);
void browser_FileDownload(ref bool Cancel)
{
}
thanks in advance...
|
|
|
|
|
how can i create ini file and read and write application settings to it?
|
|
|
|
|
There is no classes available in .NET framework to do this. You have to work with win32 function GetPrivateProfileString[^]. Or use the file manipulation classes provided with .NET and write your own parser code to parse and read the file contents. An INI file handling class using C#[^] explains wrapping the win32 functions.
|
|
|
|
|
|
|
Hello. I have an issue. I need to turn on wireless/gprs (like using wrlsmgr or wirelessmanager.exe) and configure them (ips, gateway - for wireless, and apn, login, password - for gprs). I'm using a Windows Mobile 6 PDA and VS2008.
Sorry for the poor english.
Any kind of help would be appreciated. Thank You.
Fabio Lopes
|
|
|
|
|
|
Prezado Fabio Melo,
Me chamo Rodrigo Araújo e estou na mesma situação que seu post descreve.
Apesar de ser de setembro de 2009, resolvi me cadastrar no code project só pra te perguntar se vc conseguiu resolver a questão.
Eu estou desenvolvendo para WM6 com C# e preciso detectar e ligar/desligar a wifi do dispositivo via código.
Mesmo depois de tantos meses, não acho nenhuma solução na net.
Vc conseguiu resolver de alguma forma?
Muito obrigado.
Rodrigo Araújo
|
|
|
|
|
Hello to every body.
My name is Christian and i´m not a c# developer (I´m a VFP developer) but some how i manage to built a little UDP server listener app in c#.
I needed to do this becouse I will have several vehicles that send a data via GPRS to the server each minute and the server should be listening and decode the data to store in the database (MySql). There will be hundreds of entries per minute. I Hope that somebady can tell me if my code is multithread or not and if it´s not, how can i implement it. Also, if i need multithread in the database part. The source code is in this link:
http://www.mediafire.com/file/kze3zztjzve/httprequest.rar[^]
|
|
|
|
|
Welcome to CP!
Christian_V_V wrote: The source code is in this link:
http://www.mediafire.com/file/kze3zztjzve/httprequest.rar[^]
This is not how CP works. People hardly download code. You can post the relevant code here and ask about doubts.
Christian_V_V wrote: There will be hundreds of entries per minute
There are many things to consider when implementing a highly scalable server application. Few of them are,
- How much users will be connected simultaneously? If this is more than 50, you are better off with asynchronous methods. It allows to create highly scalable applications. If you have less number of users, asynchronous methods will add unnecessary complexity to your program.
- Are you starting new thread for each client? If yes you will run into problems. You need to use a
ThreadPool . I have once written a highly scalable server with a custom thread pool taken from Smart Thread Pool[^]. - From my experience, I found it is best to work directly with
Socket class rather than the wrapper class like UdpClient . - If you need to keep reference to the clients that are connected, you should consider using a data structure that will allow faster searches. In .NET,
Dictionary class is good and it allows searching in O(1). You will find this[^] MSDN article helpful.
Christian_V_V wrote: Also, if i need multithread in the database part.
Databases are already multi-threaded. What do you meant by that?
|
|
|
|
|
Hello.
I have not found any information on this part as of yet, and I need a little bit of help.
What I have done is I have my base class that has a bunch of properties and for each property I have a attribute on it. I have other classes that will inherit this class
<pre>public abstract class MyBaseClass : IEnumerable
{
protected bool m_TableName;
protected Guid m_ID;
protected string m_DisplayName;
//CustomProperty is in the format "Field Name", Display in the grid, Database field
[CustomProperty("TableName", false, true)]
public string TableName
{
get{return m_TableName;}
set{m_TableName = value;}
}
[CustomPropety("ID", false, true)]
public Guid ID
{
get{return m_ID;}
set{m_ID = value;}
}
...
}</pre>
Now here is my next class which will be where I store my collection of classes
<pre>public abstract class MyTableObject<T> : IEnumerable<T> where T: MyBaseClass
{
protected List<T> m_Rows = new List<T>();
protected SQLConnection m_conn;
//other methods and variable not needed for my example
...
protected AddNewRow(T newItem)
{
m_Rows.Add(newItem);
}
protected FillData(SQLCommand newCmd)
{
DataTable dt = New DataTable();
using(SqlDataAdapter da = new SqlDataAdapter(newCmd))
{
da.Fill(dt);
foreach(DataRow dr in dt.Rows)
{
AddNewRow(???);
//now what I need to do is basically a T tmp = new T(); AddNewRow(tmp);
//but you can not do that it errors out.
//other code under her for adding all the fields.
//Also have a similar one for building a select statement, base insert, base update statements
}
}
}
}</pre>
Any help on this would greatly be appreciated.
The MyTableObject is the base object that all my other table object will inherit so I do not want to do the fill code at any higher lever
Thanks
modified on Tuesday, September 8, 2009 8:05 PM
|
|
|
|
|
What error do you get exactly ?
Christian Graus
Driven to the arms of OSX by Vista.
Read my blog to find out how I've worked around bugs in Microsoft tools and frameworks.
|
|
|
|
|
I'm afraid some of the type specifiers (such as <T> ) are missing in the code you have shown; to prevent the browser from interpreting them (they look like HTML tags), you should replace < by < (which happens automatically when you click the < widget on top of the edit box).
Feel free to edit and fix your orginal post.
|
|
|
|
|
Daniel.J.A wrote: //now what I need to do is basically a T tmp = new T(); AddNewRow(tmp);
You need to add a new() .
public abstract class MyTableObject<T> : IEnumerable<T> where T: MyBaseClass, new()
{
}
|
|
|
|