|
hiiiii....all
Assume you have a lan in your office,,,,All the computers there are clients ....and i wanna to develop a software for communuication between clients...the appliaction will have array of the ips of the network,the user selects a specific ip,,,and press (send button) to transfer any file to the Computer with the specific id(Communication may be files or text)
the Communication is two way to,,,as computer A can sends to Computer B and vice versa
i think that UDP is good,,,but i cannot understand it,,
please any one who have developed a software close to that,,Send me Anotification
Thanks,,,,all
|
|
|
|
|
peter micheal wrote:
i think that UDP is good,,,but i cannot understand it
I've never used UDP, but if you're going to be using sockets I think that TCP is a better option.
A good book on Sockets is C# Network Programming by Richard Blum. It describes UDP as a connectionless protocol. A quote from the book: "Connectionless sockets allow the sending of messages in self-contained packets. A single read method reads the entire message sent by a single send method... Unfortunately, UDP packets are not guaranteed to arrive at their desitnation" (pp210)
So, what I understand from this is that something sent via UPD must fit in one packet (typically 1500 bytes, which includes the space reserved for the IP headers) AND if you send a file this way it may not reach its destination. Certainly the books example code for using UDP never sends anything greater that 1kb.
If you are going to do network programming then I do recommend a good book on the subject. The one I mentioned above is an excellent book for use with C#. That way, if you do still have problems then you can be more specific in posting a question.
Back to your problem: You will need to have a process running on each of the clients that is acting as a server (it is able to receive incomming communications). If you say they are all clients you will go round in circles trying to figure out get them to communicate with each other. Always you need a client process (which initiates the request) and a server process (which responds to the request). In your cast a request is sending the file from one computer to another.
Next, you will need some protocol of your own to permit the transfer. You will need to tell the receiving computer (the server) how much data you are going to send at the very least so that it knows when to stop looking for more data. (You may also like to add in things like filename, timestamps, usernames and other relevant metadata) Now, there are off-the-shelf protocols already available in the .NET Framework that will assist you in this, but if you want to use Sockets you will have to do all the hard work yourself.
Does this help?
"You can have everything in life you want if you will just help enough other people get what they want." --Zig Ziglar
"On two occasions, I have been asked [by members of Parliament], 'Pray, Mr. Babbage, if you put into the machine wrong figures, will the right answers come out?' I am not able to rightly apprehend the kind of confusion of ideas that could provoke such a question."
--Charles Babbage (1791-1871)
|
|
|
|
|
I got a text file that i exported from SQL Wizard and i named bank.txt.
i want to write out a program that allow to import bank.txt file to SQL Server but i do not know how to do it.
So can anyone help me or show me where to get the source code.
Thank a lots.
Mr Duc Linh Nguyen
|
|
|
|
|
quocbao wrote:
I don't know import data into Sql server from file text, when user give a file text.
Your question is a little vague as you don't define the contents of the text-file.
Do you want to do this programmatically?
You could use the DTS wizard that comes with SQL Server (Import and Export Data) as this app will pretty much do the job for you.
If you want to interact with the DTS via C# then have a read of HOW TO: Create a Data Transformation Services Custom Task by Using Visual C# .NET[^]
Alternatively, you could read the text file, parse the contents and then squirt the data into SQL using ADO.NET.
Michael
But you know when the truth is told,
That you can get what you want or you can just get old,
Your're going to kick off before you even get halfway through.
When will you realise... Vienna waits for you? - "The Stranger," Billy Joel
|
|
|
|
|
My job requires me to write a an application that will collect data from a Web Form and then dump it into MS Message Queue. May I reqoest help from you experts to show me, after collecting the data from the form, how I could achive that within C# .NET. Do any of you folks have any code snippets?
I am doing C# for only few months and love it but I got stuck here.
Regards,
Login
|
|
|
|
|
Have you look at MessageQueue class?
Mazy
"I think that only daring speculation can lead us further and not accumulation of facts." - Albert Einstein
|
|
|
|
|
I'm using VS .NET and in the solution Explorer i can see a .exe file but i can't find a .dll for the same file. I need the .dll for assembly referencing. Is there a way of creating the .dll when i only have a .exe
|
|
|
|
|
Not unless you rewrite the code to be in a .DLL. The two files have very different entry points and startup routines.
Visual Studio wont let you set a reference to an .EXE, but the commandline compiler, csc, will let you reference an .exe. There was another thread in this forum that spelled this out earlier this week.
RageInTheMachine9532
|
|
|
|
|
Just try renaming it from exe -> dll should be ok dll -> exe will obviously not.
top secret
|
|
|
|
|
In the following code pTable is of type CustomerTable, which inherits from DataTable. How can I change the "if" statement to check that pTable is derived from DataTable as the statement currently tests false, because the types are different. I thought I would cast ptable, but the of course that would throw an exception if that cast is invalid.
if (pTable != typeof(DataTable))
{
throw new EwGeneralException(lStk, EwExceptionID.DdlNotDataTable);
}
Many thanks for reading.
Nursey
|
|
|
|
|
Can you try
if (typeof(pTable).BaseType !=typeof(DataTable))
....
James
|
|
|
|
|
You're comparing apples and oranges, there. pTable is an instance, and the typeof operator will always return a Type , so the two would never match unless pTable was a variable which held a Type .
If you want to check is something is an instance of a particular type, simply use the is operator:
if (pTable is DataTable)
{
} You can also use something like this, although it requires more code and more instructions (when compiled to IL):
if (pTable != null)
{
if (pTable.GetType() == typeof(DataTable))
{
}
} There's other ways of doing this, but you don't have to take inheritance into account. If CustomerTable inherits form DataTable , then any instance is a type of CustomerTable , DataTable , MarshalByValueComponent , and - as with everything in .NET - Object . It's also an instance of any interfaces that any classes up the inheritence hierarchy implement.
This isn't true going down the hierarchy, though. For example, if you instantiate a new instance of a DataTable , then it is not an instance of a CustomerTable .
Also keep in mind that it's not the declaration that counts, its the definition. For example:
object o = new DataTable("Example"); While o is declared as an object , it's still an instance of a DataTable . Calling o.GetType will return System.Data.DataTable . This is polymorphism.
Microsoft MVP, Visual C#
My Articles
|
|
|
|
|
I've developed a simple attribute EwBindSkipAttr which is then used on an abstract member of a class, in the hope that all derived classes which must then implement this member will inherit the attribute on their overriding members. This seems to be correctly implemented...the documentation states that the default is for derived and overriding members to inherit attributes. Here's my simple attribute in use...
///
/// Return DDL wrapper for table
///
[EwBindSkipAttr]
public abstract DataDDL DDL{get;}
The problem is that in the derived classes I have behaviour which indicates that the attribute has not been inherited. Any thoughts please?
Nursey
|
|
|
|
|
Attributes are inheritted by nature, but code which gets and uses these attributes - like MemberInfo.GetCustomAttributes - provide parameters that specify whether or not the calling code wants to get inheritted parameters.
What behavior is this that you mention? There's many things that can contribute to problems you're facing. Remember, attributes don't provide functionality to Types, they merely extend the metadata of a Type so that if something asks for it the attribute and its data is returned. Simply attributing your class with a custom attribute certainly won't do anything if nothing asks for it and uses it.
Microsoft MVP, Visual C#
My Articles
|
|
|
|
|
Hi Everybody - Happy Easter, have a peaceful weekend...
I'd like to ask, to what extent do you use the XML tags in your code (such as summary etc.)
I wonder if you could point me to some code that you consider "model" in its illustration of good practice. Also, do you use any additional tools.
I have a developed an architecture that I consider elegant and simple to use, but to maintain it, it would require good documentation. I would welcome any thoughts and guidance so I can get past my basic use of summary and parameter tags.
Many thanks.
Nursey
|
|
|
|
|
At least document everything public and protected, anything which can be seen by other code. Use all relevent XML tags. This includes, obviously, the <summary> . If your method has parameters, then use the <param> tags. If you return values, use the <returns> tag. If you explicitly throw an exception or let one slide that you want to make sure developers know is possible, use the <exception> tags. Basically, use any tags that are relevent to the to member. If you want to provide more information about something, then use the <remarks> and/or <example> tags.
For a great and free documentation compiler, see NDoc[^]. I've had the pleasure of working on it and I know this product is stable. Just look at the huge list of clients, including Microsoft. It can generate many formats like HTML Help 1 (ex: VS6 docs) and 2 (ex: VS7+ docs). It looks just like the current VS.NET / MSDN documentation as well.
For larger products in a corporate environment, you might consider abstracting all comments away to separate files. Then use the <include> tag to specify an XPath expression that imports the documentation. This seems to be what Microsoft does since many members - especially overloaded methods - share the same content for various sections.
Microsoft MVP, Visual C#
My Articles
|
|
|
|
|
Hand, Stop, and Error all use the big X.
Warning and Exclamation share a triangle with an exclamation point.
Asterisk and Information share a bubble with a lower case 'i'.
Does this provide the option for me to replace these icons with my own?
|
|
|
|
|
Bupkus wrote:
Hand, Stop, and Error all use the big X.
Warning and Exclamation share a triangle with an exclamation point.
Asterisk and Information share a bubble with a lower case 'i'.
That is correct. It is a hang-over from the "olden days" ( Am I getting old?) when the enumerations had different names.
Bupkus wrote:
Does this provide the option for me to replace these icons with my own?
Not as far as I am aware.
"You can have everything in life you want if you will just help enough other people get what they want." --Zig Ziglar
"On two occasions, I have been asked [by members of Parliament], 'Pray, Mr. Babbage, if you put into the machine wrong figures, will the right answers come out?' I am not able to rightly apprehend the kind of confusion of ideas that could provoke such a question."
--Charles Babbage (1791-1871)
|
|
|
|
|
If you want a better message box, create one. With the MessageBox in the FCL, what you see is what you get. This P/Invokes the native MessageBoxEx API, which is also limited.
Just build a Form derivative with a lot of the same functionality, perhaps exposing a public property for setting icons or stick the with single, overloaded method like MessageBox.Show where you can provide a custom icon. The Form derivative should be smart enough to resize itself when need and to allow for the customization of Button s based on what's needed, as well as where to place them. It's really not as hard as it might sound, though, and many developers including myself have done this from time to time to provide a more feature-rich dialog.
Microsoft MVP, Visual C#
My Articles
|
|
|
|
|
hiii...alll
i 'd like to send data files and text between clients ,,,with no servers in between(No Ftp Server).....
Also I wanna to know the connection between clients
Thanks,,,all
|
|
|
|
|
kano zangeef wrote:
i 'd like to send data files and text between clients ,,,with no servers in between
This is a little vague. Can you be more specific?
I assume you mean outside of a LAN situation. And I am also assuming you don't want your existing windows to act as FTP servers either (which could have been an option as it is built into Windows). Further, I am assuming that you want the files to be transferred both ways - In other words Computer A can send files to and request files from Computer B, and also Computer B can send files to and request files from Computer A.
kano zangeef wrote:
Also I wanna to know the connection between clients
Sorry, I don't understand this. Do you mean what technology do you need to use in order to achieve your goal? Or what?
"You can have everything in life you want if you will just help enough other people get what they want." --Zig Ziglar
"On two occasions, I have been asked [by members of Parliament], 'Pray, Mr. Babbage, if you put into the machine wrong figures, will the right answers come out?' I am not able to rightly apprehend the kind of confusion of ideas that could provoke such a question."
--Charles Babbage (1791-1871)
|
|
|
|
|
I think he means something like P2P networks without a central server. The Gnutella protocol is one example.
Microsoft MVP, Visual C#
My Articles
|
|
|
|
|
If you want to create a P2P network, you need to either define and implement the protocol yourself, implement an existing protocol, or use an existing protocol along with an existing library. Windows XP SP1 introduced a new P2P library that I know someone here was working on wrapping.
If you don't need an entire P2P network of clients and just want to communicate between two distinct clients, then you just need to use simple socket communications or .NET Remoting (a much more powerful technology using ubiquitous protocols like HTTP and SOAP).
For more information on .NET Remoting, see Accessing Objects in Other Application Domains using .NET Remoting[^], as well as http://www.ingorammer.com[^]. Pick up a good book, too. With power (extensibility) comes complixity.
For simple socket communications, see the System.Net.Sockets[^] namespace in the .NET Framework SDK, specifically the Socket class (for low-level comms), or the Tcp* and Udp* classes. Note that using this mechanism you're still left with defining at least a simple protocol whereby clients agree to so that they can communicate correctly.
Microsoft MVP, Visual C#
My Articles
|
|
|
|
|
How do I open a Collection Editor for a property in code? I know how to open if via the property editor. I want to force it open via code. Obviously it's doable, because VS.NET is doing it in the property editor.
Any ideas?
Kyosa Jamie Nordmeyer - Cho Dan
Portland, Oregon, USA
|
|
|
|
|
Jamie Nordmeyer wrote:
Obviously it's doable, because VS.NET is doing it in the property editor
I think that is part of the Visual Studio IDE and not part of the .NET Framework.
"You can have everything in life you want if you will just help enough other people get what they want." --Zig Ziglar
"On two occasions, I have been asked [by members of Parliament], 'Pray, Mr. Babbage, if you put into the machine wrong figures, will the right answers come out?' I am not able to rightly apprehend the kind of confusion of ideas that could provoke such a question."
--Charles Babbage (1791-1871)
|
|
|
|
|