|
CheifyW wrote: and be forced to buy upgrades.
Where'd you get that idea? Anyone forcing you to buy an upgrade?
I are Troll
|
|
|
|
|
Eddy, I don't know if you are being sarcastic or what Uncle Billy has been forcing me to buy upgrades ever since VB2 hit the shelves a long way back.
|
|
|
|
|
I want to add two tables row-wise using APPEND.
i dont know about it.
Please help me for this......!!
Thanks in Advance
|
|
|
|
|
lalit14 wrote: I want to add two tables row-wise using APPEND.
MindBlowing..!
which Tables? Database..!I think this is C# Forum
If Yes Use Join Not Append..!
|
|
|
|
|
Ya database tables but i want to append them with C# Coding not in SQl or MS Access
|
|
|
|
|
For tht purpose also You added it with join query in the query ..!Or You want to append columns and present it in datagrid..!
Can You Be More Clear?
|
|
|
|
|
Hi all,
Would like to explain the need first,
There is device attached to the server, device reads data, server validates it and stores in the DB.
So, this part is put in as windows service.
But, simultaniously, data also need to be put into TCP channels so that other systems can access the data directly(real time application).
i.e., if the UI application is running the client side then it takes data from the TCP channel and show it to the user.
Is it the correct way of doing real time applcation?
I could able to connect the windows service and the UI applcation. But it is working in local system only. There is previlage error if i put the UI application in other system.
Please let me know is there any other efficient method or how can i solve this issue.
Regards,
Kishor
|
|
|
|
|
So, considering you haven't said anything about how your client is connecting to the service, or anything else useful about your app or the error message your getting, how is anyone supposed to answer this?
|
|
|
|
|
I appologise for that.
Let me brief the application,
1) There are many devices connected in the network
2) All the devices report to the server (the windows service located in server will monitor each device)
3) Rate at which device read may be 100 read/sec.
4) When device reads the data comes to the server thorugh the windows service and this service will post the data on the TCP channel and also the DB. (DB is for storing data permnently and TCP channel data is for instant and temporary use)
5) There may be any number of clients connected on the network. who actually get the TCP channel data and show the instant(real time) report(if the client system is ON).
code used to collect the data from TCP channel is :
remotableMessage =(ServiceMessageRemotable)Activator.GetObject(typeof(ServiceMessageRemotable),"tcp://localhost:9090/ServiceMessage");
MessageBox.Show(remotableMessage.serviceMessage.Message);
Here in this is line, localhost is used. I would like know how it can be done for remote server.
I gave IP address instead of localhost. But it is saying "NO previlage". Please advice.
Also, i would like to know that is this the efficient/safe way of real time data handling.
Regards,
Kishor
|
|
|
|
|
This program open source to do forms style circle
Ameen alseady
|
|
|
|
|
amen al-seady wrote: This program open source to do forms style circle
Ameen alseady
Excellent. That's great news. I'll form a human chain around the world and give it a hug.
"WPF has many lovers. It's a veritable porn star!" - Josh Smith As Braveheart once said, "You can take our freedom but you'll never take our Hobnobs!" - Martin Hughes.
My blog | My articles | MoXAML PowerToys | Onyx
|
|
|
|
|
Are you talking about this[^]?
If so, why?
Some developers have way too much time on thier hands... I mean:
CircleDock wrote: The dock appears where your mouse is by pressing a hotkey (default is F1)
Nobody uses F1 for anything usefull - right?
Oh, and BTW - does this have to do with C#?
No trees were harmed in the sending of this message; however, a significant number of electrons were slightly inconvenienced.
This message is made of fully recyclable Zeros and Ones
|
|
|
|
|
OriginalGriff wrote: Nobody uses F1 for anything usefull - right?
Not in VS they dont
|
|
|
|
|
Its about Tcp/Ip and threading
Here i am modifing some others work and have very little clue about both tcp & threading.
The application is about sending and recv data thru tcp
On Intialize() method :
try
{
Thread trStartListening = new Thread(new ThreadStart(ListenThread));
trStartListening.Name = "Thread_tcp_Listen_" + addTcp.PortNo.ToString();
trStartListening.IsBackground = true;
trStartListening.Start();
}
catch(Exception e)
{
OnSocketError(e.Message);
}
In ListenThread() method:
IPEndPoint localEndPoint = new IPEndPoint(IPAddress.Any, addTcp.PortNo);
TcpListener server = new TcpListener(localEndPoint);
try
{
server.Start();
while (!ShuttingDown)
{
TcpClient client = server.AcceptTcpClient();
byte[] bytes = new Byte[256];
string data = null;
NetworkStream stream = client.GetStream();
lock(this)
{
int i;
while((i = stream.Read(bytes, 0, bytes.Length))!=0)
{
....
}
}
}
server.Stop();
}
catch (Exception e)
{
OnSocketError(e.Message);
}
On Send method
try
{
curXmt = TransmittDir;
string Conn = CDS.GetConnectionString(curXmt);
int port = 13000;
string Ip = "";
ParseConnectionString(Conn,ref Ip,ref port);
Sendingip = Conn;
TcpClient client = new TcpClient(Ip, port);
string Message = CDS.GetMessage();
byte[] data = System.Text.Encoding.ASCII.GetBytes(Message);
NetworkStream stream = client.GetStream();
stream.Write(data, 0, data.Length);
client.Close();
}
catch (ArgumentNullException e)
{
.....
}
catch (SocketException e)
{
.....
}
And On UnIntialize()
public void UnIntialize()
{
ShuttingDown = true;
}
Application working fine if condition are ideal, but when i call UnIntialize(), recv and sending stop.
Then i have to restart the whole application again for proper working.
A few question i have
a) Do i have to abort the thread in UnIntialize()?
b) If a thread started does it calls itself without any explicit calling?
Or we have to call/create it again?
c) What is life of a thread(if we set IsBackGround = true, then it aborted by OS). But what if we dont mention it.
d) When we starts Tcp/Ip listner, how long it listens. any life period?
|
|
|
|
|
Hum Dum wrote: Do i have to abort the thread in UnIntialize()?
Nope. Aborting a thread forcefully using Thread.Abort is a bad practice. When you set ShuttingDown = true , the thread will exit safely.
Hum Dum wrote: If a thread started does it calls itself without any explicit calling?
You need to explain what you meant here.
Hum Dum wrote: What is life of a thread(if we set IsBackGround = true, then it aborted by OS). But what if we dont mention it.
When IsBackground is true , it ends when the parent thread ends. An active foreground thread can make the application alive and it can run to anytime.
Hum Dum wrote: When we starts Tcp/Ip listner, how long it listens. any life period?
It listens until you stops it or timeout value reached.
Hum Dum wrote:
try
{
Thread trStartListening = new Thread(new ThreadStart(ListenThread));
trStartListening.Name = "Thread_tcp_Listen_" + addTcp.PortNo.ToString();
trStartListening.IsBackground = true;
trStartListening.Start();
}
catch(Exception e)
{
OnSocketError(e.Message);
}
The try/catch is pointless here. Exceptions thrown from a thread won't be caught here. It will be handled by the exception handler provided in the thread's executing method.
Hum Dum wrote: Then i have to restart the whole application again for proper working.
Once thread stops, it will stop sending and receiving. You need to start the thread again if you need to continue listening.
Your code has lot of flaws and I'd suggest to take a book on networking in C# before you do serious network programming.
|
|
|
|
|
N a v a n e e t h wrote: Hum Dum wrote:
If a thread started does it calls itself without any explicit calling?
You need to explain what you meant here.
With reference to my previous post,
we setting ShuttingDown = true in UnIntialize() method?
program checking its value in ListenThread(), and it is on the thread i started. So, when will this ListenThread() get called next time?
It get called automatically?
Here problem i am facing is, if i call UnIntialize() and then call Intialize(One in which i am starting the thread) the app. not working.
I call them on Start, Stop button on form.
I have to exit main application, then only it works.
any help?
regards
|
|
|
|
|
You are not resetting the ShuttingDown variable's value. On initialize method, add
ShuttingDown = false;
|
|
|
|
|
thanks for replay.
but what about my question?
When we assign a task to thread does it completes it and stops there.
and we have to call it again for same work.
And if yes?
then creating same thread again and again (if we are using that work frequently) going to create any overhead?
Do you spot me to any link for threading or refer me a book on networking and threading.
regards
|
|
|
|
|
Hum Dum wrote: When we assign a task to thread does it completes it and stops there.
It executes the method and returns. When method execution is done, thread ends.
Hum Dum wrote: then creating same thread again and again (if we are using that work frequently) going to create any overhead?
You are not using the same thread. Each time a new thread will be created. There is an overhead associated with creating threads. It is negligible for small number of threads.
Hum Dum wrote: Do you spot me to any link for threading or refer me a book on networking and threading.
Here is one for threading[^]. Here[^] is one MSDN article on network programming.
|
|
|
|
|
I debugged the application, when i press start button i.e calling Initialize()(after stopping thru stop), it jumps to ListenThread() method,
when server.Start(); //this lines comes, it exit thread by saying code with 0
but if i use server.Stop() in UnInitialize(), then its working fine.
Now, other problem is, what if server is already stopped, how can i check TcpListner state. (for server variable plz see original post, In ListenThread() method)
regards.
|
|
|
|
|
Just disable the start button when clicked and enable it back after pressing stop. This will prevent unnecessary clicks on the start button. I am not sure, but TcpListener.Active[^] should give you the status of listener.
|
|
|
|
|
Hello,
I'm trying to open a datetimepicker control when i'm clicking on different button,
but i can't find the right property/function at the picker.
I tried -
dateTimePickerHourString.Select();
but i got "NULL REFERENCE..."
What i'm doing wrong??
|
|
|
|
|
tamir901 wrote: What i'm doing wrong??
Have you initialized dateTimePickerHourString ?
|
|
|
|
|
Richard MacCutchan wrote: Have you initialized dateTimePickerHourString?
It gets the current time and date
|
|
|
|
|
tamir901 wrote: It gets the current time and date
Have you actually checked through the debugger that it has been initialised, as it is unlikely to complain of a NULL reference otherwise.
|
|
|
|