What to use to make two .net programs transfer information [duplicate] - c#

This question already has answers here:
What is the best choice for .NET inter-process communication? [closed]
(8 answers)
Closed 9 years ago.
I currently have two programs that need to comunicate one with another. It doesn't have to be something complicated, it's just passing data from one to another, all very simple. I was thinking of using .net remoting, but I've heard there's a new thing WCF. Should I go for the .net remoting or try WCF? Or is there something simpler to use?
edit: Both applications are simple, I don't want to have anything to do with IIS, services and such.
Thanks

use WCF with named pipes binding, here you can find useful examples

The magic phrase is "inter-process communication". Then you'll be able to find answers like this.

WCF has a bit of a learning curve, but it's a very powerful communication framework. If you have some time to learn it, I'd recommend that over .NET remoting.
If you just need a super-simple mechanism, you could just write data to a file, then read it from the other program (assuming same machine). If it has to go over the network, using a plain Socket in .NET isn't too bad.

I've used .Net remoting for this in the past, and its worked very well for me. Its very simple and straightforward for something like you describe.

If you look into WCF now, I really don't think you would regret later. WCF is great and useful for this purpose.

If you want something really simple, just put the data in a database or a file.

Related

.NET desktop client app: sockets or HTTP requests? [closed]

Closed. This question needs to be more focused. It is not currently accepting answers.
Want to improve this question? Update the question so it focuses on one problem only by editing this post.
Closed 7 years ago.
Improve this question
I'm trying to set up a Windows service that can communicate asynchronously with a server, the idea is to transfer some strings. The format, well, it really doesn't matter that much.
So, in the local network, I'm cool, I even wrote a simple mobile app to test it with requests and it just works.
The problem is I now have to make it work from outside the network, and to make it happen I would have to forward the port from the router configuration, and that is really not an ideal scenario for deployment on user machines.
I've read that is the thing you normally use sockets for, but as far as I understand, at least with .NET, the server has to have the same framework (please correct me if that is not true), and in my case the server is not .NET.
Honestly, I don't know much about client-server interaction, and I have a huge conceptual blackout when reading the official Microsoft documentation, so scratch that. I've caught glimpses of WinSock and RPC from the docs, but a C# implementation feels like duct tape, and really a last resort.
That said, I reckon I need to make six questions:
Plain HTTP is a bad idea. Right?
Given the scenario, is sockets what I need? And if it is,
How can I implement that on the server? Also,
Is it better than using RPC?
How exactly does RPC work anyway? What do I need to read before the official docs?
What does a socket do to actually let the client receive an asynchronous call from outside the local network? (need it, I read it's possible)
Please forgive me if I am mixing concepts here, and thanks for reading.
NOTE to moderators: If this is a duplicate question in any way, or off topic, or invalid for any other reason, please help me first by pointing me in the right direction. I tried to give it a good search before posting, but since I am not so familiar with most concepts, I might have missed the one. Thanks!
Some answers here:
The problem is I now have to make it work from outside the network, and to make it happen I would have to forward the port from the router configuration, and that is really not an ideal scenario for deployment on user machines.
Portforwarding is only needed when connecting from outside the netwerk to a computer inside network (behind a router). So if a user machine connects to a computer directly on the internet, you don't need portforwarding. If a computer from the internet connects to a computer in your local network, you need to forward a port in your router. So it only affects your network.
I've read that is the thing you normally use sockets for, but as far as I understand, at least with .NET, the server has to have the same framework (please correct me if that is not true), and in my case the server is not .NET.
No, A socket from .NET can communicate with any implementation of socket from another language/platform. Only when communicating binary, you should be aware for endians.
Honestly, I don't know much about client-server interaction, and I have a huge conceptual blackout when reading the official Microsoft documentation, so scratch that. I've caught glimpses of WinSock and RPC from the docs, but a C# implementation feels like duct tape, and really a last resort.
In my opinion .NET has a solid base for handling sockets. There are many technics implemented. The async sockets are very scalable for many clients
That said, I reckon I need to make six questions:
_Plain HTTP is a bad idea. Right?__
Why would you consider Plain HTTP is bad? This is very usefull when the server is writting in other languages, like PHP/Python/ASP.NET anything that uses HTTP. If you're sending user private information, you should hash/encrypt it
Given the scenario, is sockets what I need? And if it is,
Depends on how to connect to the server..
How can I implement that on the server? Also,
Is it better than using RPC?
I only used RPC in form of WebServices, You can only use this, when de server has implemented it. There are some benefits to WebServices.
How exactly does RPC work anyway? What do I need to read before the official docs?
Read more here: https://msdn.microsoft.com/en-us/library/ms950421.aspx
What does a socket do to actually let the client receive an asynchronous call from outside the local network? (need it, I read it's possible)
There is no difference between communicating between inside and outside the network. Directly communicating via sockets is always asynchronous.
Regards,
You should use Websockets. I don't know why you saying that the server and client should have the same framework, this is not the case, I have used it with C# client with NodeJs backend.
https://msdn.microsoft.com/en-us/library/system.net.websockets.websocket(v=vs.110).aspx

How to communicate between processes? [duplicate]

This question already has answers here:
What is the best choice for .NET inter-process communication? [closed]
(8 answers)
Closed 6 years ago.
I can come up only with serialization, using of WCF, etc.
But is there the standard common way for communication between 2 processes in .Net?
UPDATE: What I actually mean how to communicate between 2 processes locally when I do not need to use WCF, Remoting and network at all. Are there some ways of doing it? And I am interesting in more elegant ways than storing data to HDD or to database.
With no other information, I would suggest using WCF with a named pipes configuration:
What is the best choice for .NET inter-process communication?
You can also look at .NET Remoting. But for all intents and purposes you shouldn't be using it unless you have explicit requirements that are satisfied by remoting like...in-process, cross-appdomain communication.
I would just look at WCF's NetNamedPipeBinding. It sounds like it's exactly what you want: http://www.codeproject.com/KB/WCF/wcfipcsample.aspx
Also it seems this question has already been answered:
Interprocess communication for Windows in C# (.NET 2.0)
C# - WCF - inter-process communication

Too many frameworks for java web. Scared and Confused :( [closed]

Closed. This question is opinion-based. It is not currently accepting answers.
Want to improve this question? Update the question so it can be answered with facts and citations by editing this post.
Closed 3 years ago.
Improve this question
I am an experienced Java developer who is trying to learn web development with Java presently. I also had web development experience with ASP.NET (c#) and PHP. I know what basic concepts (JSP, Servlet, Bean) and looking for a framework to go.
My question is not "What is the best framework for Java" or something similar.
After reading many threads on here and searching on Google for many hours I feel scared and confused. There are so many frameworks and endless combinations. I'm about to change my mind to do this in .net or even PHP.
Is Java really suitable for very small teams (1 or 2 members) to develop web applications?
Is Java really suitable for developing web 2.0 applications?
Isn't .NET and PHP are far less confusing in this context.
If choose a framework and after 6 months I decide to use another, is it possible to migrate easily?
It just feels doesn't right to spend a same effort that I spent to learn Java to a framework that anytime can be changed or become useless. Am I wrong?
Is Java really suitable for very small
teams (1 or 2 members) to develop web
applications?
Of course it is, as long as those one or two team members know Java well. This is a ridiculous question that depends on how you'd like to define "suitable". I'll err on the side of conservative and interpret "suitable" as "possible".
Is Java really suitable for developing
web 2.0 applications?
Are you asking if JavaFX is suitable, or can the web 2.0 UI technology be Flex or something else? I haven't used JavaFX myself, but I think Java back ends can co-exist very nicely with web 2.0 front ends. Services are services.
Aren't .NET and PHP far less confusing in this context?
Your wording needs some work. There, I've fixed it. Depends on how well you know .NET or PHP. PHP is arguably "less engineered" and more straightforward, but every web app isn't a web CRUD app. .NET can be as engineered as Java, but it has the perceived virtue of using features that are part of the framework. At least everything is from Microsoft. Maybe you're confused because there's more choice with Java.
If choose a framework and after 6
months I decide to use another, is it
possible to migrate easily?
It depends on the framework and how well you layer your application. I would say that if you layer your code properly things should be modifiable. But frameworks tend to be glue code, so if you depend heavily on the framework it'll be hard to extract it no matter which one you choose.
It just feels doesn't right to spend a
same effort that I spent to learn Java
to a framework that anytime can be
changed or become useless. Am I wrong?
Anything can change and become useless. Microsoft can decide to re-write their Enterprise Framework 4.0 in such a way that it's not backwards compatible. I don't believe it's a language flaw - Java isn't the only one that's prey to this scenario.
You're right - you're always at risk when you take on a dependency. You're also at risk when you write and maintain everything yourself. You need to choose well to minimize risk, but you can never eliminate it entirely.
My recommendation? Choose Spring and sleep at night. It's a terrific framework that's hung in there for eight years and counting, still going strong. It has a great web MVC framework and lots more. The idioms it encourages will make your Java apps better: more layered, easier to maintain, possible to play nicely with other frameworks, minimizing your risk. They're owned by VMWare now, so they aren't going anywhere.
I think you'll find quite a few varied answers. I'm a .NET developer, I personally love to use .NET, ASP.NET and ASP.NET MVC. If you are comfortable and know Java well, why not stick with what you know? You're right that there are a myriad of framework choices, and this is true for pretty much all the platforms.
Java is suited for both small and large teams. Having a good source control solution in place will benefit any team, so make sure you consider how you are managing your source when working in a team.
The whole Web 2.0 isn't really fixated on a specific server-side technology. The broad concepts of Web 2.0 (even though it's just a magic term) is that of building rich, interactive applications. You could have a Java backend, a .NET backend, and PHP backend, a Python backend, really the choice is entirely up to you. Can they provide the same sort of services to calling clients? I think they can.
PHP and .NET benefit from huge development communities (not saying Java doesn't), and there are a whole host of projects going on with this platforms. Taking .NET as the example, you can extend it, you can build on it, heck you can even pull bits out and replace it with your own. I wouldn't say that you can't do that in Java, it's just that it would seem (to me) to be easier with .NET.
Migration is a tricky beast, you've got to be mindful of how your using the technology, and if you are doing something particularly special, how well would that translate using another technology. If you stick with a familiar design philosophy (such as MVC), you'll find it easier than say migrating from an JSP straight to ASP.NET MVC, etc.
Computing software moves at an amazing pace, and we all have to keep up or get left behind. You've got to ask yourself, are you making this platform decision for personal or business reasons? If it's for personal reasons, do you feel that you are likely to enjoy developing this in future, is it for personal growth and development? Where do you see yourself taking it? If it's for business, can you see what sort of investment you are making in this technology? Are there likely to be any winds of change which would make you question your choices at this stage?
Sorry if that's all cryptic, I hope it helps.
I don't think there is anything wrong with trying to stick with what you have already known. But there are many web frameworks out there that can help you deliver a product much faster. You mentioned ASP.NET and php but there is also RoR which is very popular and quick to get going. Not to mention that a lot of these languages have web frameworks that speed things up even more. I would start looking at these vs going JSP or some other Java approach.
But this is just my opinion.
I suggest you to use frameworks that use POJOs. With spring, wicket and hibernate/ibatis you will be OK for a long long time.
My opinions:
answers
1: yes
2: what really is a web 2.0 application? (yes)
3: no idea
4: will hurt you few days, but will certainly be possible.
5: depends what frameworks you decide to use. (yes)
"DON'T PANIC" -The Hitchhiker's Guide to the Galaxy
I have significant experience building web apps in Java, .NET, and Rails. PHP, not so much. So here's my very opinionated opinion:
Web development frameworks in Java (there are a bunch, but look at Spring) are mature and easy to learn. So if you want to run with Java, you're definitely not doing anything dumb, regardless of your team size, or the "web 2.0"ishness of your project. It's all good.
That said, here are some things to think about if you want to explore other options anyway:
C# is a way better programming language than Java, and I used to be a Java fanboy. They're very similar in many respects, and the transition is easy, but C# just fixes so many of the pain points in Java, and just holds together a lot better. I know you're not asking about languages, but if you're considering different platforms, it's definitely a factor.
Until recently, Web development was a real pain in .NET, because ASP.NET with web forms was pretty awful for non-trivial projects. There is a relatively new MVC platform released by Microsoft. It's nice, easy to work with, and has a growing community. On the other hand, it's practically your only .NET option (aside from Monorail, which has a shrinking community and a lot of bugs).
.NET isn't strictly tied to Windows thanks to Mono, but there's definitely a Windows skew to the community and libraries, and the Mono project is always a bit behind. You'll have to decide if that's relevant to you.
Rails is a blast. A lot of things that are complicated in other frameworks are trivial in Rails. It's certainly not without its issues, but for getting a solidly-architected product running in very little time, it's tough to beat.
Unless you have a very good reason to use java for web development, don't. Statistcally speaking, PHP is king in web development. You will also find many more frameworks and much better support for web development.
If you want to take a step away then try python, ruby, or CGI. They are all decent backends that work just as well in most area's that PHP does.
The main thing here is to go with what you know. Unless it's java.
Very few still use Java for web development. PHP is the winner in this sense because of the community and the immense choice of fully-featured applications available for free. Enterprise level apps are easier to implement using .NET, due to the new features in C# and due to the existence of SharePoint. Python is also used by many, including Google and YouTube. Ruby has its fans due to the Ruby on Rails platform and its language elegance.
I have many acquaintances working exclusively in Java, and get paid very well, but they practically don't touch the Web part.
My opinion is very subjective.

Improve proficiency in programming [closed]

As it currently stands, this question is not a good fit for our Q&A format. We expect answers to be supported by facts, references, or expertise, but this question will likely solicit debate, arguments, polling, or extended discussion. If you feel that this question can be improved and possibly reopened, visit the help center for guidance.
Closed 10 years ago.
How can I increase my proficiency in programming? I have a grasp of the basics of C#, but don't feel too confident about my ability.
Code something in C#
Read C# Code and try to understand it.
Read a C# Book (and please none of the C# in 21 Days books)
The confidence comes with the experience.
Read Stack Overflow every day :)
Seriously. Try to solve interesting problems. Even if you don't post your solution, come back later and see if other people came up with something similar, why their solution might be different, etc.
Project Euler.
http://www.asp.net/LEARN/videos/
Voile, you are programing ASP.net.
Keep in mind that you may need a little more grasp on C# as your codes evolve. For that use a good book, most Microsoft's learn C# are pretty neat(The learn ASP.net is quite lame).
Of course, thats what I did back then(about 2 years ago), nowadays you should be able to find some awesome tutorials online.
Good luck ;)
Think of a fun project of some complexity (more that "Hello, world") and code it.
Practice, practice, practice!
Also read forums, blogs, participate in discussions. You will learn many things that aren't even mentioned in books.
read lots of code, write lots of code and keep a copy of C# 3.0 in a nutshell handy.
Learn new programming languages. Learn data structures and algorithms and design patterns. Learn regular expressions. Learn databases. Learn HTML/XHTML/DOM. Learn learn learn learn learn.
In programming, knowledge === power.
Work on something, even if it's reinventing the wheel. You can read books, watch videos and listen to podcasts all day, but the real experience comes from actually building an application. Don't build an application that you know you can build - instead, create an application that is slightly out of your reach, then rinse and repeat.
The experience when you realize that you created a mess of spaghetti code that is unmaintainable cannot really be substituted, as this then really allows you to look into techniques to improve your code. Sure, feel free to read on MSDN about Events, Delegates and Lambdas, but reading about them in the moment you need them means that the knowledge really burns into your memory.
I try to have a rough knowledge about as many topics as possible, but that's usually rather shallow: I know that a technique exists and roughly what problem it solves, so that when I need it I can learn about it.
In my opinion, the only alternative to first-hand real world experience is even more first-hand real world experience.
http://www.appdev.com/csharp.asp
:)
You say you are learning ASP.NET and C#. Have you ever done any programming or web development? Because, if you have not, then you need to take a step back and learn the basics of HTML, CSS and get a grasp of how data is passed via HTTP between client and server. I would also strongly advise getting a grounding in basic SQL, because most serious web development will utilise databases at some point.
After that, some basic OOP (Object-orientated programming) theory would do you good. That way you have a good grounding in the subject-matter before diving into the coding.
For learning C# the I'd suggest a couple of good tutorials:
The C# Station Tutorial and Softsteel Solutions C# tutorial.
I also found the ASP.NET Quickstarts useful when I was learning ASP.NET - I prefer to learn by example than by theory.
As for confidence, I'm afraid that only comes via experience. Perhaps try answering a few questions here? Getting a few up-votes might just give you that boost. Good luck.
This fits in to catagory of answers you've received thus far, but review open source projects.
Understand how they work and maybe even why they were put together in a given way. Not only will it improve your ability to write C# but it will also improve your understanding of Software Engineering which is ultimately how you put a programming language -- C# or otherwise -- to good use.
Creating a Project that makes use of a lot of different technologies is a good way to grasp a 'big picture' view.
As an example, think of an n-tier application where you input a value into a very simple web page, this value being sent into a web service, and behind that WS a simple business layer that switches between readings into a table of a data base, then you return the value finishing the output in a postback of the initial web page. In my Personal opinion, every element of the layer is a simple one, but, making the whole system work without errors is good beginner's challenge, that way you could build a confidence in your skills, enabling you to undertake any other idea.
Well, that were my two cents. Good Luck!
There may be so many projects that u can make.choose the project that makes u.it's true take a project that you consider difficult for your level.
1) analyse your project
2) define the objective
find things that are necessary to achieve the objective
3)then derive an algorithm which clearly explains the workflow
4)then start woking
In my experience "Learn By Working" is a good idea.first grab the basics then start the work soon you'll learn step by step.never give up ,be a ceaseless crusader.
practise practise it's a only way of surviving as a programmer.
Being a best programmer requires a lot of patience,thinking skills,Attention,a thrist for knowledge.
Wise people always replace the fear of unkonwn with curiosity
Actively participate in programming (and non-programming) forums.

Learning C#, ASP.NET 3.5 - what order should I learn in / what to skip? [closed]

Closed. This question is opinion-based. It is not currently accepting answers.
Want to improve this question? Update the question so it can be answered with facts and citations by editing this post.
Closed 2 years ago.
Improve this question
There's a lot to C# & ASP.net. Where should I start? What should I not bother focusing on?
Should I learn Winforms then WPF? Ditto for webforms / Silverlight?
Should I learn ASP.MVC or classic ASP.NET? If both, which first?
In the either/or cases - which will make more sense having known the other first?
What major .NET feature(s) should I learn upfront that will open the doors of understanding to what lies ahead?
I am deliberately not mentioning fundamentals like value / reference Types, Classes, object-oriented concepts, etc since they should come first, before specifics. Here, I am interested in specifics.
[edit - added detail of what my goals are]
Good points raised - "what do I want to write"?
Basically, an intranet application that monitors a set of documents and implements a workflow as a change control process. The app will also audit the documents and report problems, self-correcting common errors. A lot of the parameters will need to be end-user definable and pluggable. The document format needs to be adaptable to different proprietary formats although they are fundamentally the same. The app will be very modular.
I'm leaning towards a web interface because the client specs & admin rights will vary - a browser is really the only thing I can count on.
As you can see, it's a bit of everything.
What do you want to write? If you want to write a Windows client-side app, look into WinForms and WPF (no real need to learn WinForms before WPF, other than the way that a lot of tutorials/books will probably compare WPF concepts with WinForms concepts). If you're looking at a web app, then ASP.NET or ASP.MVC - I don't know whether you really need the "normal" ASP.NET before MVC.
Silverlight is a bit of both, in a way - rich client probably talking to a server for interesting data etc.
Before learning any of these though, I suggest you learn the fundamentals which are one step up from the topics you mentioned - things like how text works in .NET (including encodings and regular expressions), I/O, perhaps threading. Oh, and LINQ :) There are a few books which are very good on this front:
C# 3.0 in a Nutshell
CLR via C#
Accelerated C# 2008
I had the same question when I moved from Classic ASP to .NET 2.0... .NET is huge: so where should I start?
What i did was put my hand dirty and started slow, take a project (in my case was a very important project - a finance web app that would cover and automatize all 4 persons work) and start to implement, every time I didn't know how to accomplish something or I had an idea in ASP but not in ASP.NET I would go to www.asp.net or 4GuysFromRolla website and search for examples, copy/paste, understand what I was doing and ... continue to the next wall.
Took me 6 month to have everything up and running but was worst it! now that passed almost 3 years I know I did the right choice but back then ... I was scared!
now... you refer .NET 3.5, it has a bunch of new things like extensions, linq, etc... I would go by the simple part and when the times comes, "maybe I can use LINQ here, let me search how to use it on this part"
hope you follow your own path and buy some reference book so you can read something new and have a reference whenever you need "ahhh, I read this somewhere in the book, let me search... where was it?"
I bought Professional ASP.NET from Wrox as a reference book, and even today I go there to see new things, even when I'm started to use .NET 3.5, the idea is there, there is only a new way to accomplishing it.
I would recommend learning whatever you are interested in. Pick a "pet project" and try to create it using one of the technologies you listed. If you enjoy making windows desktop style applications, then go with WPF or WinForms. If you enjoy the idea of making rich desktop style applications on the web, then go for Silverlight. There will be a ton of overlap.
But in terms of core .NET Development, if I were starting off fresh, I'd recommend learning ASP.NET MVC first, as it will give you a good basis for things like: Designing for Testability, coding without ViewState, SEO-friendly URLs, etc..
It depends (awful response, I know, but let me explain)
Are you going to do any windows forms development? You mention C# and ASP.NET, so to me it sounds like you are doing Web-based programming. If so, skip Winforms and WPF for now.
Silverlight is worth checking out, but it is still fairly new so I'd make it a 2nd priority.
Now to the MVC or Web forms question. MVC gives you total control over the HTML, CSS, and Javascript that is emitted, but requires more work, whereas Web forms gives you ease of development but without 100% control over the markup that is emitted. You can do lots with Web forms and the introduction of MVC doesn't threaten the future of Web forms. MVC is very new so things are changing but eventually I see them both living happily side by side.
Regarding learning .NET in general, I've heard great things about a book called CLR via C# which will go over all the fundamentals and inner workings of .NET.
Definitely learn the fundamentals (like you already mentioned) like how the CLR handles types, garbage collections, security, "AppDomains", threading, etc.
For ASP.NET, learning the "page life cycle" and "control life cycle" are essential. Also, session state and data binding are probably good things to understand.
I wouldn't worry about WinForms, WPF, or Silverlight for now. They won't directly help with ASP.NET and are relatively easy to pickup after you've learned the CLR and .NET Framework fundamentals.
What is your primary objective - learning for fun or hireability? If you're a student and years out from worrying about a career in programming then I will strongly echo the idea of picking a project about something relatively simple that you're interested in and then just doing it.
Say you want to create an application that will track your video games collection. First you'll need a way to store the information - this will be a combination of c# and some persistence strategy like mySql or SQL Server or XML.
Then you'll need a way to present your collection and interact with it - adding, deleting and editing objects and persisting the changes. In this step, use every presentation technology that you're interested in - WPF, WinForms, Asp.net, asp.net with MVC, Silverlight - whatever you're interested in. As you learn to do one, you'll learn techniques you'll need to use in the next.
Don't pick just one - play with all the ones you have any interest with at all.
Now, if you're primarily interested in what skills will get you hired the quickest, I'd say look at your market, but it's probably going to be straight ASP.Net skills that will be the most in demand - or at least that's what it looks like from my perspective. In a couple of years it may well be ASP.Net MVC skills. In some markets though you'll have an easier chance of getting VB6 work. It all depends on where and when you're looking.
I highly recommend the following books, for learning about whats new in ASP.NET 3.5
ASP.NET MVC 1.0 Website Programming
Professional ASP.NET MVC 1.0
ASP.NET 3.5 Website Programming
Sometimes videos might help. I learnt everything I needed to know to start off with from a set of video tutorials from Total Training which is here. Pricey if you buy the disks but there is a cheaper online only option.

Categories