|
Hello, I need your help and guidance, I am feeling lost.
I have a tcp/ip socket server application that receives messages threw a router.
my hardware sits on wireless network, creating messages, and pushes them to a tunneling router than in it's time push the messages to a middleware PC
with a socket server program, listening for the data.
my problem is, when i disconnect the tunneling router and reconnect, the connection breaks, and I can't keep receiving messages from the router.
this causes an instability issue for me, since network crashes can happen, and I need my network to survive them.
what you think might be the problem?
How can I solve it?
any help will be most appreciated.
|
|
|
|
|
gizmokaka wrote: the connection breaks
What connection? I am not able to clearly understand your layout description.
|
|
|
|
|
OK from the top:
I have a wireless RF network in which I have units running and sending messages.
the receiving end for the messages is a tunneling router with one end RF receiver and the other has
TCP/IP port, and this tunneling router translates from one network to TCP/IP packets then it forwards
the messages to a PC that's running socket server application that listens constantly on a specific port, and when data is received it handles it.
when I say the connection breaks I mean, I disconnect the tunneling router from the network,
and reconnect it.
when it's reconnected it's no longer able to receive messages.
the thing is, if I disconnect the network cable it simply breaks with a message box
saying something about lost messages and stops receiving messages, but the program doesn't crash.
but if I disconnect it's power, it breaks with an exception
"An existing connection was forcibly closed by the remote host"
and stops the program.
of course I am talking of debug mode.
hope it's clearer now.
if my reply will be late, I am sorry, I promise to reply to every comment
tonight or tomorrow.
thanks again for your help.
|
|
|
|
|
gizmokaka wrote: OK from the top:
I have a wireless RF network in which I have units running and sending messages.
the receiving end for the messages is a tunneling router with one end RF receiver and the other has
TCP/IP port, and this tunneling router translates from one network to TCP/IP packets then it forwards
the messages to a PC that's running socket server application that listens constantly on a specific port, and when data is received it handles it.
gizmokaka wrote: I have a tcp/ip socket server application that receives messages threw a router.
my hardware sits on wireless network, creating messages, and pushes them to a tunneling router than in it's time push the messages to a middleware PC
with a socket server program, listening for the data.
So your "socket server" runs on the middleware PC and listens on a specific port which the router connects with and sends data.
gizmokaka wrote: when I say the connection breaks I mean, I disconnect the tunneling router from the network,
and reconnect it.
when it's reconnected it's no longer able to receive messages.
It can't receive messages from the RF devices? Or from your "socket server". Any connections that you had from your socket server to the router are dead when you disconnect the router from the network. After you reconnect the router, it must establish a new socket connection to your socket server. Are you saying it doesn't do that?
How does it initially connect to your socket server? The router must be configurable yes? Perhaps you missed a configuration property that tells it to re-connect after it detects the network presence. Or perhaps it is not capable of doing that, if not there is not much you can do.
|
|
|
|
|
I have built a windows form using C#( .NET 2.0 ). The form has a label with text set to “:My label text.” When I build and run the form here everything looks fine.
When a person is running the form in UK he sees the label text as “.My label text:”
I am not able to figure out the reason for the colon to be moved to the end and the fullstop to be moved to the front.
I don’t think the UK locale would be causing this.
Have seen this happening?
Thanks,
Sudhir
|
|
|
|
|
Isn't by any chance the colon and fullstop entered with right-to-left text mode?
|
|
|
|
|
Not only that you should also think about internationalization. In the UK the date and time format is different and they are also using a different codepage (English/US vs English/UK).
|
|
|
|
|
hello techs,
I have a small project which enables database backups.
I have to to do backup's for multiple database @ a time.
For that i need to use Threading concepts.
the below code is for database backup :
-----------------------------------------------------------------------------------------------------
public void backUpDatabase(string DBname, string setBakUpPath)
{
SqlCommand sCom = new SqlCommand("BACKUP DATABASE " + DBname + " TO DISK = '" + setBakUpPath + "' WITH NOFORMAT, NOINIT, NAME = 'Full Database1 Backup', SKIP, NOREWIND, NOUNLOAD,STATS = 10", sCon);
sCom.CommandType = CommandType.Text;
try
{
sCom.ExecuteNonQuery();
MessageBox.Show("Database " + DBname + " : BackUp Done!", DBname + " BackUp", MessageBoxButtons.OK, MessageBoxIcon.Information);
}
catch (System.Exception ex)
{
MessageBox.Show(ex.ToString(), "Backup ", MessageBoxButtons.OK, MessageBoxIcon.Information);
}
sCom.Dispose();
}
-----------------------------------------------------------------------------------------------------
all the databases will be loaded to a list box and i will select a database and clicks on button "Backup Database" and it will starts backup.... I need to do the backup in a thread. Now on the datagrid ... it will show the "db name", "Status : backup going on/backup done" and finally % of percentage of backup in the third colum of grid (u can avoid if this a bit time consuming... )
Please help me to solve it, if any clarifications needed... please ask ... thanks ...
A123-B321
|
|
|
|
|
jikubhai wrote: and finally % of percentage of backup in the third colum of grid
That's a good one considering you are making a blocking call to perform the backup
jikubhai wrote: sCom.ExecuteNonQuery();
|
|
|
|
|
|
What you don't know what "blocking call" means? You might need to study some fundamentals before you develop production applications.... just a thought.
|
|
|
|
|
Hello,
Hope someone can help with this, I've built a collection which I'm then using to populate a ListView. I need to somehow be able to sort the ListView by 2 columns, column indexes 3 then 2. The ListView contains information about advertisements in a publication and I need to be able to sort by section (column 4, idx 3) then page no (column 3, idx 2). The thing is, how?
I know I need to use the ListViewItemSorter method somehow but I've no idea how to attach the required columns. It will only ever be these 2 columns and they will always have the same position in the ListView (idxs 3 & 2).
Hope someone has a work around for this, I've managed to do it in a DataTable but can not get it working here yet. If anyone has a different solution to this problem, please don't be shy. I'm more than open to new ideas.
Thanks in advance everyone,
Scott
|
|
|
|
|
|
Hi,
same as for any other collection you want to sort (array, ArrayList, ...):
write a class that implements IComparer and pass that to the Sort() method; on a LV that
happens through setting ListViewItemSorter property.
Implementing IComparer means providing a single method that takes two objects and returns an int:
int Compare (
Object x,
Object y
)
the int value should be negative, zero or positive depending on the sort order of the
two objects;
you would have to cast these objects to whatever type it is you have in the ListView.Items collection
Luc Pattyn [Forum Guidelines] [My Articles]
this months tips:
- use PRE tags to preserve formatting when showing multi-line code snippets
- before you ask a question here, search CodeProject, then Google
|
|
|
|
|
Hi!
I think one important point that might not be entirely obvious is that you sort by one column first and only have to return the result of the second column's comparison if the items to compare are the same in the first column!
Regards,
mav
--
Black holes are the places where God divided by 0...
|
|
|
|
|
I need to safely open a text file and send its contents to a textbox, if it doesnt exist i need to create it and then open it and show nothing in the textbox. I keep getting a "file is in use by another process" error.. here's my code..
TextReader fstream;
fp = filepath;
try
{
fstream = new StreamReader(fp);
}
catch (System.IO.FileNotFoundException)
{
File.CreateText(fp);
fstream = new StreamReader(fp);
}
bool done = false;
while(!done)
{
Alert = fstream.ReadLine();
if(Alert = null)
{
done = true;
else
{
textBox1.AppendText(Alert + "\r\n");
}
}
fstream.Close();
|
|
|
|
|
Dio22 wrote: I keep getting a "file is in use by another process" error
If another process has the file open in non "share" mode you will not be able to open it. Perhaps you have it open in some editor or something?
|
|
|
|
|
nope, nothing has it. error only happens when the file doesnt already exist. *shrug*
|
|
|
|
|
Dio22 wrote: error only happens when the file doesnt already exist. *shrug*
Yes that is because you are trying to create it in the catch() while you still have the active StreamReader in the try{} block.
|
|
|
|
|
Hi all,
Please could someone help me !!!!
I have a static class that I wish to use to create event handlers on controls.
I know the name of the class and method, I then want to create an instance of that class and assign one of its methods to be the event handler of the control. Bellow is roughly what I want to do (but it isn’t working )
object obj = Activator.CreateInstance("project1", vItem.Value.ToString());
pCtrl.TextChanged += new EventHandler(obj.GetType().GetMethod("MethodForEvent"));
The obj is wrapped instance and the getMethod returns null
Any Ideas ?
John
|
|
|
|
|
john34 wrote: Any Ideas ?
What are you trying to do? Is this some sort of plug-in solution?
|
|
|
|
|
Is there any significance to the use of the @ in a variable name (like @intx)?
Thanks.
|
|
|
|
|
The @ symbol is usually used for SQL Server parameters
SqlCommand.Parameters["@ID"].Value = 1234;<br />
<br />
CREATE PROC sp_MyProc @ID INT <br />
AS<br />
SELECT * FROM Table WHERE ID = @ID
The at symbol is also used to escape string literals
string path = @"C:\Program Files\Some Folder";
only two letters away from being an asset
|
|
|
|
|
sa_runner wrote: Is there any significance to the use of the @ in a variable name (like @intx)?
Using @ means that you can have a variable name that (sort of) matches a type name, e.g. object @object. In your code you can then refer to @object. It really doesn't seem to be good practice to me.
Deja View - the feeling that you've seen this post before.
|
|
|
|
|
In SQL yes, in C# no.
You can use it in c# as well, but the only thing that happens is that Intellisense does not work on this variable
-^-^-^-^-^-
no risk no funk ................... please vote ------>
|
|
|
|