Re-Implement 3rd party TCP Java client - c#

I need to know if there are any tools to figure out the interface to a TCP client. My Company has purchased a 3rd party tool and we really like the Server side and most of the client side.
I would like to see if I can figure out the calls that the client side makes to the server so I can create the client side functionality we want.
I have been able to figure out what the port number and protocol that the client communicates with the server on. Since we host the server, I have full access to that too.
Any ideas on how to get hold of and execute the methods that the client app is calling on the server?
I am not that good at java, so I would like to use C#.NET if at all possible. Does that sound feasible?
NOTE: I have done something like this before (connect to a 3rd party Java Based Server with a custom .NET client) but that time I had a bit of documentation to get me started. This time I have nothing.
Any Help will be greatly appreciated.
Also, if you know better tags for this please post them as comments (or just re-tag if you have the permissions)

If you're trying to reverse engineer the protocol so you can write your own client to the server, get Wireshark. You can use it to follow the conversation between client and server.

You could attempt to decompile the library. That should give you all of the low-level info that you need.

You could also use TCPMon to grab the exact message text passed between client and server.

Related

Making two programs talk with each other

My group in the university are working on a project, which includes us making a C# program. We have a vision of making a server side console program that is constantly calculating data and then make a client side program that can fetch the data from our server side program. The client side program will then be able to display the data and the user is able to navigate forth and back around the data. Both of these programs will be run on the same computer solely for exercise purpose.
I am wondering how I can get data from the server side program and be able to display it on the client side program.
If both client and server are always on the same machine, there is no need at all to use WCF or Sockets. You can use named pipes for the interprocess communication.
If you're trying to do a more serious client/server application, I recommend you to try Redis which provides a lot of remote features like pub/sub and caching, so you'll avoid reinventing the wheel.
As mentioned in the comments that sounds like you would like to create a "server" like application which you could do with WCF.
http://tech.pro/tutorial/855/wcf-tutorial-basic-interprocess-communication
There are also some workarounds if you wish to do so, using a Database or use a folder containing Text Files,that would include a folder watcher, which you than read, but they are not that elegant.
You can get data to the client program by configuring it by using web.api self hosting. Here is a great link. The server app can be configured to use the same thing. They can both listen and answer one another.
http://www.c-sharpcorner.com/UploadFile/b1df45/Asp-Net-web-api-self-hosting/
Why don't you give ASP.NET Web API a chance?
You'll be creating a REST API that not only a C# program can talk to (any language/implementation - even another server) can talk to your server as long as the end point is correct (in your case would be your IP address and port number) & of course, you don't need both programs to be on the same computer as well :)

How to send message from client to server using Apache Thrift

I am creating an application using Apache Thrift technology http://wiki.apache.org/thrift/. I knew how to create a connection between client and server and I can call a function stored in server by client.
But now, I want to send a message from client to server like "Hello from client", and the server have to recieve and print it. I can do it by using the .NET framework and multi-threading waiting for message. But I would to use the Apache Thrift Technology because of my lecturer's offer.
After server recieved this message, it can reply it to client something like "I got it", and client side will get this message.
So how can I do that by using Apache Thrift, please give me some advices or some reference materials on it. I would like to use C# to create my application.
Thanks in advance.
Since you did not post any code, I can only give you the generic outline.
There are two resources worth looking at when starting with Apache Thrift. First, there is the tutorial, which is about a small calculator app demonstrating the basic principles. Theoretically, this should already cover all you need for your task.
But wait, there's more: The other resource is the Thrift Test Client/Server program, which besides its primary purpose also gives a good sample and showing a number of techniques regarding the different protocols and transports.
The creation of a client with C# boils down to this:
// put together a protocol/transport stack as required by the server
TTransport transport = new TSocket("localhost", 9090);
TProtocol protocol = new TBinaryProtocol(transport);
Calculator.Client client = new Calculator.Client(protocol);
// make sure the transport is open
transport.Open();
// call a method via RPC
client.ping();
Again, I encourage you to make your question more specific, if you have a concrete problem. The above sample code can be easily found in the docs via Google 1), so I bet that is either not the real problem or you may be just looking for someone doing your homework for you.
1) Just look for "thrift tutorial" and click the very first entry in the search results.

Remote Data Transfer Using C# .NET?

I am looking to write an application that will take client data from a database, transfer it to our server application, manipulate that data and then pass it back to the client. I would like this to be as seamless as possible and as secure as possible. Also, the manipulation part of this could take several hours. The format of the data will be different for each client. To make the application as easy to maintain as possible, the simplest solution too.
What methods would people recommend for achieving this?
WCF will make your implementation easy. It looks like you are wanting to have the client -> server -> client communication asynchronous, since the server process can take hours, you don't want to block your client that long.
You probably want to define a server WCF service contract to allow the clients to load data to the server. You also want a client side WCF service contract that the server can use to send the results back when the processing is completed. OR you can have the server send a small message to the client WCF service telling it that "results are ready, come and get them when you are ready". You will need to coordinate this with some type of ID; the server tells the client to use this id when it wants to collect the results.
Have a look for duplex, asynchronous and peer-to-peer communication topics in WCF. There should be plenty of examples if you google around.
Please take a look at WCF framework of .NET 4.0.
1/backup the database in prod
2/download it,
3/restore in local
4/modify,
5/backup in local
6/upload
7/restore in prod
to download in https or sftp, with ip restriction
you can compress the database before download it too

Intercept HTTP requests

I've some fishy application that makes HTTP requests to a website, i would like to intersect that request and send other data to the server. Is that possible in C#,java or C++?
EDIT: The application isn't mine, i just know the endpoint that it sends http requests
Fiddler might provide the functionality you need. At the very least it may enable you to see what is being sent to the web site.
in Java You can intercept request from Filter
You may want to look into using an HttpModule, whose purpose is to intercept incoming HTTP requests.
The ASP Column: HTTP Modules
Firstly are you aware of how it is connecting to the internet? For example, is it using the settings from Internet Explorer, or is it establishing a direct connection? If the latter, this may be tricky, there is no direct port forwarding as there in Linux, so you'll need some third-party tools to redirect the traffic to a server (which you can write in Java, C++ or C#, I would go for C# if you know it for pure speed of development) In that server you can intercept the request, and then create your own to actually send to the real destination.
Sounds like a cludge, but I think you're stuck with this approach due to the lack of direct port forwarding. You'll have to configure the third-party tool that you use to forward someother well known port to 80, and your server should write to this.

How to create an IM bot with C#

Is there an easy way to create an IM bot on multiple im networks (aim, gtalk, yim, etc) that can accept and interpet specific commands sent to it to perform a server related task?
Lets say for instance I have a website for managing an rss feed. I want to send a command to an IM bot to add another feed to my collection. the IM bot would associate my screen name with my account from prior setup on the website.
I have done some internal bots for my company using the XMPP (Jabber) protocol, I've used the agsXMPP SDK and the Jabber.NET client libraries, I was looking for APIS to work with YIM, AIM and Windows Live Messenger but I've found only COM exposed APIS, nothing for .NET...
But an idea comes to my mind, with the XMPP Protocol you can configure a local server with IM Gateways, that allow users to access networks using other protocols through your server
I use eJabberd, you can install a variety of transport gateways to connect with other IM protocols (AIM, MSN, ICQ, GTalk...
To GTalk you can connect directly using the libraries I mention...
A sample ICQ gateway:
The short answer to this question is yes this can be done relitivly easily. Sedning and receiving IMs sending, receiving and interpreting requests from the network you wish to communicate on and there are libraries available for each of the major IM protocols to make this easier.
For messenger you can try the DotMsn library, I have used it in the past but at that time it was still quite new and I have not used it since so I can't vouch for it's quality.
Jabber uses the XMMP protocol which is an open-standard so there are bound to be plenty of client libraries available.
If I recall correctly Google Talk uses this protocol or a modified version thereof.
I dont have experience with c# but I have written one for AIM and Gtalk using PHP. http://www.imified.com/ is the best place to start if you looking for a easier way to write an IM bot.
Basically you create an account in imified.com .
Name your bot and link a script.
When ever a message is sent to the bot, imified.com automatically runs this script.
Here is a link for you get you started!
We have professional .NET/COM/VCL library for MSN/Yahoo/ICQ/AIM/GTalk/Jabber. Please take a look at http://www.imcomponents.com/ if you like.

Categories