1. I need some code that will allow users that use my application to chat to others using the application on a different computer.
Just to make things difficult my computer is behind a firewall(I can't allow access for chat) so I doubt that I can run it from my comp, but I have an FTP server. Would that work?
2. Also if anyone knows is there anyway that two users can give each other stuff? Example: User 2 sends an Apple to User 1. User 1 send 50 Gold to User 2
How would an app know when you send an item or gold?
Search this forum for sockets, tcp sockets, chat etc. there are numerous examples. You'll probably be looking into the tcp socket stuff. You'll need a server that clients can connect to.
If the FTPserver is a separate computer it should work fine as long as it isn't behind a firewall and allows you to open ports. Otherwise if your firewall allows you to open ports then you can do that.
I've struggled to find a decent server & client example for ages but have found one which i have attached. You'll have to do some research into it as well as stream reading & writing for sending messages.
I presume it's going to be more than two people interacting over this chat.
To send gold and so on, on the client side you can send a message to the server (eg give Bob 100 gold), which in turn would send a message to the user you are sending stuff to, to tell them they have received gold from you. increment the gold variable on the receivers end (Bob's side), send a message from the receiver to the server which sends a message to you telling you the gold was successfully transferred and then decrement your gold variable.
Optionally you can store all data such as username, password, gold etc in a database wherever the server app is located to keep track of all the users info which could also eliminate the need to send so many messages back and forth between client->server->client. This way you can send the 'give Bob 100 gold' message to the server, the server updates Bob's gold in the database and then sends a Refresh command to bob to tell him his new gold amount.
It will take a while to go through the supplied code but it is worth it as it will give you most of the code you will be looking for you'll just need to figure out how to manipulate it.