How to connect a Chat Client to a game server? - c#

I just want to create a "Chat Client" that can connect to a Game Server..
My problem is that I dont know how to start, I've already read several tutorials about socket programming / chat client / server client / etc. but I can't find a way to implement it on a game server.
The server I want to connect is a Battle.net server "Warcraft III".
I've already know the IP Adress of the server but I dont know how will I able to access the game server.
The IP address of the server serves as a Webserver "acts a forum" and a GameServer "of course the game itself".
to summarize my problem:
I just want to create my own "Topaz Chat" using C# but I dont have any idea how to do it?
any idea? guys even a keyword is enough, I will try my best to find a tutorial for it. I know its hard to answer my question because I failed to provide any code T_T

First things first, you need to find out the protocol that the chat uses. Try to find answers to these questions:
Do you really need raw sockets?
Is the protocol a know protocol, such as IRC?
What are the chat's commands and how are they processed?
When you find these answers, you'll be half way there.

If you are saying that you can access the Battle.net to get some informations, then I believe it uses a WEB SERVICE. Using it, you can request some informations or to create a room or something. You should not use socket programming. WCF is a highter level technology of .NET. Use it as web service.

Related

C# server-client implementation with TCP

I want to create a simple messaging app that uses tcp protocol to communicate, including with multiple people. Messages get sent to the server, which distributes them to all other clients. At the moment, I have it fully functioning and it works perfectly - on a local computer and a local network, using the ipv4 address.
After an extensive Google search, I discovered that to communicate from a different network I need to port-forward my server. However, how do I make my server able to communicate with clients without all the clients port-forwarding? As far as I'm aware, not everybody's device is port-forwarded.
So, how do I implement this? Is it possible with just C#? Or did I misunderstand something, and port-forwarding isn't really required?
Thanks for all the help.
Why don't you use SignalR. I think it will be best for your problem.

C# - Network Programming - Verify client before allowing connection

I'm new to network programming as well as to stackoverflow, so I hope I won't make any bad mistakes.
I try to code a client/server application using TcpListener/TcpClient. But I don't want to accept every client trying to connect to the server.
I don't understand completely if the two parties stay connected also when the client doesn't send a request, and how it is possible to verify the client using a password or something. How could I do this?
I don't expect a tutorial but maybe a link to a good reference or youtube tutorial, I couldn't find helpful things on my research.
Thank you, fre3zr
The TCP protocol works as following: Or you accept the connection or you don't.
After accepting, you can do your checks and reject the client, if you want.
Pseudo-code:
Sock1.Accept()
If data then
Store the received data in "X"
If Password match "X" then continue, if not: KickClient()
End If
And yes, the client keeps connected when you finished sending your data, you must disconnect him in order to free resources.
Add code to your question, so we could help you more.

How to load balance a chat server?

i have a dedicated server that run a chat server made by me. But the server is almost overloaded and i want add another server to balance the users.
The servers are both a Linux Ubuntu 12.04 server and the chat program made by me was developed with c# and .NET with Mono.
The problem is that if i open another chat server on the other computer how can i make that the users can communicate between the two servers?
I will try to explain better:
User A is connected to Server A.
User B is connected to Server B.
If the user A send a message to user B that is connected to server B how i can redirect the message to the other server? What is the best solution?
Thank you in advance.
Firstly, whenever you have a performance problem, you should first try to measure where exactly it lies. Maybe you can improve the performance of your system dramatically in some way by looking into why and where it is slow. This way you might not need to scale your system at all. You could also try to scale up instead of out, which is generally easier.
If that fails I would suggest to switch to an existing chat system like XMPP or IRC. There are great XMPP libraries for C# so this would be the best solution I think.
Lastly, when you really want to scale out your own chat system in the way you described, I would suggest to just send messages as JSON over TCP. You can use fancy RPC stuff or REST APIs but for this use case I think you should keep it as simple and lightweight as possible.
It depends which part exactly is missing. There a many parts to a load balanced system.
My guess is that you are missing the backing part, which might not be so obvious.
IPAddress -> Load Balancer <= x-Servers => Backplane
This is simliar to what we used in our case for the back part:
http://www.tugberkugurlu.com/archive/scaling-out-signalr-with-a-redis-backplane-and-testing-it-with-iis-express
I hope it points you in the right direction.

Re-Implement 3rd party TCP Java client

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.

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