|
If the process id is held inside the network messages then it should not be too difficult. If the process id is not part of the messages then you would need to find the link from the routing tables and port numbers.
However, since this question really refers to a published article I think you would be better asking the question in the forum at the end of the article.
Unrequited desire is character building. OriginalGriff
I'm sitting here giving you a standing ovation - Len Goodman
|
|
|
|
|
ipNode.Nodes.Add("Ver: " + ipHeader.Version);
ipNode.Nodes.Add("Header Length: " + ipHeader.HeaderLength);
ipNode.Nodes.Add("Differntiated Services: " + ipHeader.DifferentiatedServices);
ipNode.Nodes.Add("Total Length: " + ipHeader.TotalLength);
ipNode.Nodes.Add("Identification: " + ipHeader.Identification);
ipNode.Nodes.Add("Flags: " + ipHeader.Flags);
ipNode.Nodes.Add("Fragmentation Offset: " + ipHeader.FragmentationOffset);
ipNode.Nodes.Add("Time to live: " + ipHeader.TTL);
ipNode.Nodes.Add("Source Port: " + udpHeader.SourcePort);
ipNode.Nodes.Add("Destination Port: " + udpHeader.DestinationPort);
ipNode.Nodes.Add("Length: " + udpHeader.Length);
ipNode.Nodes.Add("Checksum: " + udpHeader.Checksum);
There's all except the process
|
|
|
|
|
I thought as much, since the process id is an internal value of meaning only to the operating system, and not relevant to network traffic. However you can find the information you need by using the netstat -o command.
Unrequited desire is character building. OriginalGriff
I'm sitting here giving you a standing ovation - Len Goodman
|
|
|
|
|
The problem is that netstat dont show the source IP address of the UDP socket... and its exactly want I am looking for.
I want to know the IP of a UDP connection... Thats why I tried to "sniffer" the connection.
Seems very hard.
|
|
|
|
|
Sorry, but I don't know the answer to that one.
Unrequited desire is character building. OriginalGriff
I'm sitting here giving you a standing ovation - Len Goodman
|
|
|
|
|
hi..
I m new to Oracle and c#.still I am tryiyng to picking up stones here
currently I am working on Script Task tool in SSIS (Using c#) in which I need to store the resultset from my Oracle stored procedure in to a MS access table.Below is the code:
public void Main()
{
OracleConnection conn = new OracleConnection();
conn.ConnectionString= "UserId=XXXX;Password=XXXX;Data Source= "XXXXXXX;";
conn.Open();
//execute stored procedure here
DataTable resultDT = new DataTable();
OracleCommand Cmd = new OracleCommand();
Cmd.Connection = conn;
Cmd.CommandText = "My_StoreProc";
Cmd.CommandType = CommandType.StoredProcedure;
OracleParameter[] paramsArray = new OracleParameter[2];
paramsArray[0] = new OracleParameter("fromDate", OracleDbType.Date, ParameterDirection.Input);
paramsArray[1] = new OracleParameter("toDate", OracleDbType.Date, ParameterDirection.Input);
..and here after I am stucked how to proceed with ..
how to use Oracle dataadapter,dataset and store this result set in an Access table?Any help will be appreciated!
Thanks in advance!
BigFish
|
|
|
|
|
You shouldn't use the .NET oracle data provider, because the libraries are deprecated.
A cite:
Quote: The types in System.Data.OracleClient are deprecated. The types are supported in version 4 of the .NET Framework but will be removed in a future release. Microsoft recommends that you use a third-party Oracle provider.
Source:
Oracle and ADO.NET[^]
|
|
|
|
|
Hi there.
I am using .NET Oracle.DataAccess.dll..
I m pretty sure that it can be done.Can anyone lead me till the dataset fill?
Regards,
BF
|
|
|
|
|
What Rex said is that while it works now it will not work in the future, change your data provider before going any further.
I would extract the data into a table/list via the data connection, create another connection to the Access database and write the table/list to the destination table in Access.
Never underestimate the power of human stupidity
RAH
|
|
|
|
|
1. Write code that ONLY gets data from Oracle. If the result set is large then create a streaming idiom. You extract the results into a data structure written in C#.
2. Test it.
3. Write code that ONLY puts data into Access. You use the above data structure.
4. Test that.
5. Put 1 and 3 together.
|
|
|
|
|
Hi,
I was wondering if anyone could help me. I have a solution which contains three projects. One for data access , one for business logic and the other contains for the winforms them self and is set as the startup project.
In my winform I create instance of a method which is in BLL project. This creates the controls dynamically based on some fields in the database. I also attach the button click evens in this class. On the button click event I need to update the text in a label. How would I go about this?
If I move the class file in to the starup project I can update it by passing the form name and updating a property. But I would like to keep the class file in the BLL project.
Can anyone help?
Thanks
|
|
|
|
|
Creating controls is not business logic. This should be done by the UI layer. What the business layer should return is some object (probably a IList<FieldDefinition> or similar where FieldDefinition includes the metadata about the field that you're going to need in the view) that defines the database fields that you want controls made for.
You have done the right thing by separating the three parts, try not to smear things across those lines if you can avoid it!
|
|
|
|
|
Thanks, so should I still keep this in its own class file and move it in to the main project. The other thing i do also which I imagine is bad practice is bind or set the value of the text box at the same time.?
Thanks
|
|
|
|
|
That really depends on details of what the class is, whether it does anything useful and how important it is, so I can't really answer :p.
Sending the value that should be put in a 'control' from the business logic (as part of a FieldDefinition type data class) is fine, as long as what you're specifying is the underlying logical value. For example you shouldn't format up a number as a string, or specify font formatting information, because that's view specific.
A good test is: if you can imagine creating a non-graphical client for the method and the information it returns, it's fine to put it in there. You always need some interface code between layers and that's how you should think of this part.
|
|
|
|
|
You can pass a reference to that label to a method in the class library:
public void SetText(ref Label myLabel, string text)
{
myLabel.Text = text;
}
|
|
|
|
|
and you don't need the ref keyword to do that, better not use it here in fact.
A cleaner way is by passing a delegate, so it is the control's owner who updates the control when informed about a data change.
|
|
|
|
|
I agree with Luc - this is not a good method. The class library should not have or need any knowlege of any UI control. The normal way would be to get the text from the BusinessLayer vie a getter or string GetXXX() method and deal with updating the text in the UI layer.
Luc's suggestion of passing a delegate is an alternative aproach which is also valid and allows the calling of the update code from the BusinessLayer without it needing information about the control - the actual update is still done in the UI layer. Delegates often confuse people but they're pretty simple so here is an example. I prefer other options but here is how it is done:
namespace CommonObjects
{
public delegate void UpdateText(string text);
}
using CommonObjects;
namespace BusinessLayer
{
public class Strings
{
public static void RequestUpdateText(UpdateText updateText)
{
updateText.Invoke("New Text");
}
}
}
using System.Windows.Forms;
using CommonObjects;
public partial class FormMain : Form
{
public FormMain()
{
InitializeComponent();
RequestUpdateFromClassLibrary();
}
private void RequestUpdateFromClassLibrary()
{
BusinessLayer.Strings.RequestUpdateText(new UpdateText(UpdateTextBox));
}
private void UpdateTextBox(string text)
{
textBox.Text = text;
}
}
|
|
|
|
|
There are many ways to establish "dynamic connections" (access, ability to invoke method in, ability to set and get values) between different classes/objects. Injection, passing of references to instances of objects, Interfaces, inheritance, exposure of select values by use of Public Properties, etc.
Many of the responses here (all technically sound) assume, I think, that the UI here is a fixed design: I'm going to play "devil's advocate" and raise the question... since you told us in the OP that the UI definition is created by a method in the "Business Layer" reading from the DataBase:
"This creates the controls dynamically based on some fields in the database"."
Is it possible that the UI is, itself, not a fixed design, and that it may be different with each Application "run" ... because the DataBase fields that determine UI controls are being changed, or vary depending on other processes changing the DataBase.
If this (unlikely ?) hypothetical is false, why are you defining the UI in the DataBase ?
best, Bill
p.s. minor point: it would be a very strange scenario in which "create instance of a method" makes sense: I am pretty sure you mean that you access/invoke the method in the BL which then reads the DataBase and then one way, or another, creates the UI.
"It is the mark of an educated mind to be able to entertain a thought without accepting it." Aristotle
|
|
|
|
|
In Form2()
=========
In Form2 I have one Button and One richtextbox. And from the Button-1 I have created new form called "MyAppFrm" My requirement is while the mouse move away from MyAppFrm, Form2-RichTextBox - has to Fous(). But its not focusing...When I try to click on RichTextBox1, the control shows always in MyAppFrm. So How to achieve this...
private void Form2_Load(object sender, EventArgs e)
{
Form MyAppFrm = new Form();
MyAppFrm.MouseLeave += new EventHandler(this.MyAppFrm_MouseLeave);
}
private void button1_Click(object sender, EventArgs e)
{
MyAppFrm.Size = new System.Drawing.Size(775, 125);
MyAppFrm.StartPosition = FormStartPosition.CenterParent;
MyAppFrm.ShowDialog();
}
public void MyAppFrm_MouseLeave(object sender, System.EventArgs e)
{
richTextBox1.Text = sender.GetType().ToString() + ": MouseLeave";
richTextBox1.Focus();
}
Thanks
|
|
|
|
|
ShowDialog() is a modal operation. Did you mean to call Show() ?
/ravi
|
|
|
|
|
Have you subscribed to the MyAppForm_MouseLeave event in the some part of the code? If not you need to subscribe to it and then you can use a event handler to handle that event.
|
|
|
|
|
The ShowDialog is the problem. While the form is modal and displayed, focus cannot be returned to the parent form.
|
|
|
|
|
1. This code as-is will not compile: the new Form 'MyAppFrm' is created inside the Load event: outside of the scope of the Load event it will not exist: thus you cannot 'refer' to it inside the button1 Click EventHandler.
The "fix" for that is easy enough: make MyAppFrm a class-scoped variable defined outside the Load Event:
private Form MyAppForm;
private void Form1_Load(object sender, EventArgs e)
{
Form MyAppFrm = new Form();
MyAppFrm.Closing += new CancelEventHandler(MyAppFrm_Closing);
} 2. In your original code you can "get away with" accessing MyAppFrm in the MouseLeave event handler: because that EventHandler had a valid reference to the instance of MyAppFrm <i>when it was added in the Load event of Form2</i>. And, after all, you reference it only indirectly by calling 'GetType() on the 'sender parameter of the EventHandler.
3. Note that in the example above I changed the Event in MyAppForm to 'FormClosing, not 'MouseLeave: if you use 'MouseLeave you'll get an initial trigger of that Event just by the call to ShowDialog ... and, as explained below: showing modally excludes "leaving."
There are good reasons, at times, to show a Form using 'ShowDialog: but in your code I can't detect any reason why are you using 'ShowDialog.
When you use 'ShowDialog: the reason to use it is to prevent any "moving away from it," to block the user from changing focus until the user does something that closes/dismisses the modally shown Form.
Suggest you sit down and try and think through and outline your design goals here: what's going to be inside the new Form created (which is just a blank, "vanilla" Form, now).
If this is a homework question that really does ask "How to access the control of a form from diffrent form?:" then you should be pre-defining ... at Design-Time probably ... the new Form that is created in Form2, and put some Control on it, and focus on the issue of how you get access to that Control from Form2 ?
good luck, Bill
"It is the mark of an educated mind to be able to entertain a thought without accepting it." Aristotle
modified 10-Jan-12 14:23pm.
|
|
|
|
|
Thankyou Bill, I get clear...very nice reply...
|
|
|
|
|
Hello,
I want to create a remote support application which will aneble user to connect to a remote pc and take control of it (just like logmein), I need it in vc# .net or vb .Net. I am searching articles or web articles to guide me. Also for multiple desktop sharing (be able to connect to multiple pcs).
Thank you
Kyriakos
Kyriakos
|
|
|
|