Results 1 to 15 of 15
  1. #1
    DizzyEwok is offline Member
    Join Date
    Jun 2009
    Posts
    7
    Rep Power
    0

    Question Ambitious Noob Here - Needing Guidance

    Hi,
    I know, this is my first post, and it may seem quite ambitious, but I do know the basics of java.
    Basically, I want to create my own IM Client that runs on every computer in my school. It must not be able to connect to the internet, although if it needs to access a secure server or something I dont really care.
    But, really, I dont know where to start, Ive heard people mention about sockets and stuff, so I briefly read some documentation and I get the gist of it, but nowhere does it say anything about sending messages from computer to computer!:confused::confused::confused:
    Please could someone give me a pretty detailed explanation of what kind of things I am going to have to do to get this thing working in Netbeans 6.5 with the latest JRE!

    Thanks to Anyone Who Contributes!

    -DizzyEwok

  2. #2
    Singing Boyo is offline Senior Member
    Join Date
    Mar 2009
    Posts
    552
    Rep Power
    6

    Default

    Ouch... high demand for an early project... I've tried to create this kind of thing a couple times, and always ended up with problems I just could not figure out, but I'll see what I can do for you.

    You'll most likely need to generate both the client and the server. Also, start simple... (command line, just make sure that the client can read data from the server and the server can read data from the client) To send, messages, use BufferedReader/Printwriter with the getXXXStream() methods of the Socket class.

    There are a lot of tutorials out there, so your best bet is to keep googling.
    If the above doesn't make sense to you, ignore it, but remember it - might be useful!
    And if you just randomly taught yourself to program, well... you're just like me!

  3. #3
    DizzyEwok is offline Member
    Join Date
    Jun 2009
    Posts
    7
    Rep Power
    0

    Default

    Thanks,
    Ive looked into it a bit more, and come up with the Smack API.

  4. #4
    DizzyEwok is offline Member
    Join Date
    Jun 2009
    Posts
    7
    Rep Power
    0

    Default

    Erm, I'm not too sure how to get it working in NetBeans, all the classes and stuff dont get recognised in netbeans, help ? :S

  5. #5
    Singing Boyo is offline Senior Member
    Join Date
    Mar 2009
    Posts
    552
    Rep Power
    6

    Default

    Smack API is not a standard API... it is, in fact, very different, and because of that, not many people will be able to help you.
    If the above doesn't make sense to you, ignore it, but remember it - might be useful!
    And if you just randomly taught yourself to program, well... you're just like me!

  6. #6
    emceenugget is offline Senior Member
    Join Date
    Sep 2008
    Posts
    564
    Rep Power
    6

    Default

    hmm. this sounds like another thing i might find interesting enough to try out this weekend. havent done anything with sockets in java yet, might be interesting.

  7. #7
    DizzyEwok is offline Member
    Join Date
    Jun 2009
    Posts
    7
    Rep Power
    0

    Default

    If you get some code workin, and, if u wouldn't mind, walk me thru it.
    Thx

  8. #8
    emceenugget is offline Senior Member
    Join Date
    Sep 2008
    Posts
    564
    Rep Power
    6

    Default

    well if i do work on it, it won't be until tomorrow sometime. right now, my general thoughts are as boyo said: create a server and client. client holds username and sends msg+recipient to the server. server has some kind of switch for i/o from different users registered with it and sends/receives based on this. given that i have no experience with sockets and connections beyond http servlets in java, i don't know yet how i would have the server sort out the different ports or whatever is used to differentiate users from one another.

    a much simpler way to start off would be to make a chat server/client, where clients send messages to the server, which stores all the info while broadcasting the same info out back to all clients connected.

  9. #9
    corlettk is offline Member
    Join Date
    Apr 2009
    Location
    Brisbane
    Posts
    86
    Rep Power
    0

    Default

    Quote Originally Posted by DizzyEwok View Post
    If you get some code workin, and, if u wouldn't mind, walk me thru it.
    Thx
    Here's one I prepared earlier... It's no-where near everything you're asking for (don't want much, Do ya'? ;-) but it's a start, and it "works".

    TODO:
    1. Use threads on the client to listen for new messages whilst allowing the user to enter a new message.
    2. Use threads on the server to talk to multiple clients concurrently.
    3. The easiest way to seperate the display area from the data entry is (AFAIK) a Swing client... but Swing is hard, it should come towards the end of your noobhood.

    Cheers. Keith.

  10. #10
    DizzyEwok is offline Member
    Join Date
    Jun 2009
    Posts
    7
    Rep Power
    0

    Default

    Thanks, Ive kindve already made the GUI, but theres no code behind it, I just wanted to see if I could make it look how I wanted it to look.
    Your code seems to just connect to the server, theres no user input? is there?

  11. #11
    corlettk is offline Member
    Join Date
    Apr 2009
    Location
    Brisbane
    Posts
    86
    Rep Power
    0

    Default

    Quote Originally Posted by DizzyEwok View Post
    Thanks, Ive kindve already made the GUI, but theres no code behind it, I just wanted to see if I could make it look how I wanted it to look.
    Your code seems to just connect to the server, theres no user input? is there?
    Nope... you start the server, then when you start the client it connects to the server, which sends "hello world" (or something), and both processes terminate.

    It's a _simple_ example of a Java client-server socket program.

  12. #12
    DizzyEwok is offline Member
    Join Date
    Jun 2009
    Posts
    7
    Rep Power
    0

    Default

    Right ok, thanks.
    So now, I need to modify that code so that it doesnt automatically just send "hello world", it sends what the user types in the Swing JTextBox. Right?

  13. #13
    DizzyEwok is offline Member
    Join Date
    Jun 2009
    Posts
    7
    Rep Power
    0

    Default

    bump :P msg 2 shrt

  14. #14
    Fubarable's Avatar
    Fubarable is offline Moderator
    Join Date
    Jun 2008
    Posts
    19,316
    Blog Entries
    1
    Rep Power
    25

    Default

    I would do things one baby step at a time. If you can get hello world working, then yes, try to modify your code so that the GUI will work. I'm not sure what other information you're looking for here.

  15. #15
    Singing Boyo is offline Senior Member
    Join Date
    Mar 2009
    Posts
    552
    Rep Power
    6

    Default

    Speaking from experience trying to create this kind of thing, you need to constantly test your code, and if you find an error you can't figure out, go back to what you last had that worked. The more code/GUI you have, the harder it is to find a bug, and the more likely it is that there will be one.
    If the above doesn't make sense to you, ignore it, but remember it - might be useful!
    And if you just randomly taught yourself to program, well... you're just like me!

Similar Threads

  1. need guidance in component placement
    By rdtindsm in forum AWT / Swing
    Replies: 2
    Last Post: 05-10-2009, 04:14 PM
  2. Help im a noob.. a super noob on java..
    By critdevil in forum New To Java
    Replies: 12
    Last Post: 03-07-2009, 03:17 AM
  3. Ambitious App
    By Bubba_OH in forum New To Java
    Replies: 14
    Last Post: 10-14-2008, 01:12 PM
  4. Guidance
    By gizdev in forum New To Java
    Replies: 5
    Last Post: 09-07-2008, 07:14 PM
  5. Needing Help!!
    By kingjut06 in forum JDBC
    Replies: 1
    Last Post: 07-07-2007, 11:38 PM

Tags for this Thread

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •