Those of you that know what IRC is are probably already thinking I'm off my rocker, given the title of this post. And I probably am. I decided to try my hand at writing an IRC server in a single Java file. I've got it to the point that people can connect to it, join channels, set the channel topic, send messages (and receive them) at channels, send private messages, and change nicks, so I figured I'd blog about it and include a link to it if anyone wants to use it. It's not intended to become a production IRC server; I'm mostly writing it so that I can test out an IRC bot that I'm writing when I don't have an internet connection.
Anyway, here's the source code for the server. Download it, compile it with "javac Connection.java", and then run it with "java Connection <hostname>", replacing <hostname> with your computer's hostname. If you're not sure what your computer's hostname is, just use localhost as the hostname. Then, open your favorite IRC client, connect to "127.0.0.1:6667", and join any channel you want. You can switch nicks, set the channel's topic (even though you're not a channel op), and other users can connect, join channels, and chat with you. Sending messages directly between users also works. Modes do not, however (channels always act as if they are mode +nt, no matter what you set their mode to be, but anyone can change the topic even though the channels have +t present). I'm hoping to add more functionality to this server soon.
6 comments:
NEEDS MORE OBJECTS
can't figure out how to sue it.
*use
What port does it use? I ahve it in a jar and it's running, just can't figure what port it's on.
So, I was looking through the code, and I decided I wanted to make a command. I found a bit where it said Command CommandObject = null; blah blah blah but I couldn't figure out how it processed the different commands and how I could add one.
Post a Comment