Jump to content
  • Advertisement

MattS423

Member
  • Content Count

    453
  • Joined

  • Last visited

Community Reputation

122 Neutral

About MattS423

  • Rank
    Member
  1. in = new BufferedReader( new InputStreamReader( System.in ); String InLine = in.readLine();
  2. Oh, i thought i had the entire client up there public Client() { Socket kkSocket = null; BufferedReader in = null; PrintWriter out = null; try{ kkSocket = new Socket("DB62T411",4444); in = new BufferedReader( new InputStreamReader( kkSocket.getInputStream()) ); out = new PrintWriter(kkSocket.getOutputStream()); } catch(UnknownHostException e) { System.err.println(e.getMessage()); System.exit(-1); } catch(IOException e) { System.err.println(e.getMessage()); System.exit(-2); } try{ String InLine = " "; System.out.println("Begin Read\n"); out.println("Begin Read\n"); while((InLine = in.readLine()) != null) { System.out.println(InLine); out.println(InLine + "\n"); if(InLine == "end") { break; } } System.out.println("Disconnect"); out.println("end\n"); out.close(); in.close(); kkSocket.close(); } catch(IOException e) { System.err.println(e.getMessage()); System.exit(-3); } } Any ideas? I'm getting despeate here...
  3. here's the server code, with some comments: PrintWriter out = new PrintWriter(ClientSocket.getOutputStream(), true); String InData = "InDataInitString"; out.println("Handshake\n"); //client receives this line. BufferedReader in = new BufferedReader( new InputStreamReader( ClientSocket.getInputStream())); InData = in.readLine(); //Hangs here. It MUST be blocking somehow. //no error, but it just sits. System.out.println("Check"); //line never reached. System.out.println(InData); System.out.println("Starting Loop"); out.println("Starting Loop"); //the Loop while( (InData = in.readLine()) != null) //same error would occur here if it ever got there. { System.out.println("Looped and data present"); //to ensure proper looping. Never reached. //process InData //Write the line System.out.println("Received: " + InData ); out.println("Received: " + InData); if(InData.equalsIgnoreCase("end")) { break; } } System.out.println("Stream Closing"); out.close(); in.close(); As you can see, the in.readLine() call makes it sit and spin.
  4. The client and server send data the same way, though a PrintWriter. I don;t know if this sends the newline character or not, but to make sure, I sent one explicitly and the results were the same. Intrestingly enough, the client CAN get the text from the server but the server can't get the data from the client, even though they are sent in the same way. Here's the client code: public Client() { Socket kkSocket = null; BufferedReader in = null; PrintWriter out = null; try{ kkSocket = new Socket("DB62T411",4444); in = new BufferedReader( new InputStreamReader( kkSocket.getInputStream()) ); out = new PrintWriter(kkSocket.getOutputStream()); } catch(UnknownHostException e) { System.err.println(e.getMessage()); System.exit(-1); } catch(IOException e) { System.err.println(e.getMessage()); System.exit(-2); } try{ String InLine = " "; System.out.println("Begin Read\n"); out.println("Begin Read\r\n"); //this line is not received by server while((InLine = in.readLine()) != null) //works. { System.out.println(InLine); out.println(InLine); if(InLine == "end") { break; } }//end while. System.out.println("Disconnect"); out.println("end"); out.close(); in.close(); kkSocket.close(); } catch(IOException e) { System.err.println(e.getMessage()); System.exit(-3); } } any other ideas?
  5. Hey. I created a server-client pair that connect to each other through a TCP socket and they're supposed to be able to talk to each other....only they can't. The server program just stops and does nothing whenever the server attempts to read from the socket data stream. Here's the relevent code: PrintWriter out = new PrintWriter(ClientSocket.getOutputStream(), true); String InData = "InDataInitString"; out.println("Handshake"); // <---- This goes through to client just fine BufferedReader in = new BufferedReader( new InputStreamReader(ClientSocket.getInputStream())); try { InData = in.readLine(); // Error occurs here System.out.println("Check"); System.out.println(InData); } catch(IllegalBlockingModeException e) { out.println("end"); System.err.println(e.getMessage()); System.exit(1); } The catch statements are never reached. the in.readLine() call just seems to take forever. its obvious that the sockets are connected correctly, because i can send data from server to client just fine. The client is deffinately sending data to the server...the server is just not reading it. Any ideas? I'm kinda new at Java AND new at network programming, so any help would be great. Thanks! Matt
  6. MattS423

    collision detection help needed

    I would simply do something like this: xVelocity = -xVelocity; yVelocity = -yVelocity That should produce the bounce-back effect. Make sure the ball doesn't get stuck inside the paddle, though.
  7. MattS423

    Teach me calculus

    Did anybody tell him about L'Hospital's (Say: "Low-Pee-Towels") rule yet?
  8. MattS423

    Is what the bible says still relevant?

    Is what the Bible says relevent? (I read like, the first post...I didn't feel like reading all this conversation when I just wanted to jump right into it. Short answer: Yes. The Bible can be divided into 4 major subject areas: 1) Historical Records 2) Laws 3) Letters 4) Prophecy (the book of Revelation) Lets take them one at a time: 1) Historical Records. Archeology has never contested the historical records in the Bible. I don't have specifics, but you can read Lee Strobel's, "The Case for Christ" (which I'm sure has been mentioned by now). Strobel was an athestic journalist who set out to disprove the Bible. He wound up proving it. 2) Laws. The Old Testament is full of laws, stuff like "Don't wear clothes of mixed fabric" or "don't eat pork" or "when ya gotta go poop, go outside the camp so far, dig a hole, poop in the hole, then bury it." It also has laws like "Don't kill people" or "Don't steal stuff". Is this applicable? Well, my underwear is like, 95% cotton, and 5% spandex. does that mean I should be stoned? No. Christ fufilled the law, so we don't have to. Now, that doesn't mean that we have a license to steal stuff...Paul in the New Testament says, paraphrased, "The acts of the sinful nature are obvious", then he lists some, "So don't do 'em, bucko". Therefore, we follow certain laws, like "Thou shalt not murder" because they have moral weight. 3) Letters. These make up most of the New Testament (From like, Romans to 3 John). These books were written, mostly by Paul, to the early church in various locations (E.G. Romans was written to the church at Rome), or to a specific person (such as Timothy). Paul wrote these letters to tell the Church to love each other (in essance) and to not do the wrong thing. He didn't say "Don't do X, Y, and Z" he said "You're Christians, you have the Holy Spirit to guide you...don't do what you know is wrong". You can't really argue with that kinda logic, unless you wanted to say the Holy Spirit doesn't exist....but even without that part, you can't argue with it. 4) Prophecy. This is the book of Revelation, and various snippets of the old testament. They talk about the "End times", the anti-christ, when Christ returns, sets up his 1000 year kingdom, etc. Rev. was written by John, and the other snippets by various prophets. Basically, John was a good christian (he knew Jesus personally during Jesus' earthly existance) and we believe him. It should be noted that none of these prophecies contridict each other. I also believe the Bible because it talks about God, and God has clearly been at work in my life. If you would like me to elaborate, I will, but I'll leave it at this for now.
  9. MattS423

    MessageBox() problem!

    Any ideas about why this is happening, or a possible workaround/
  10. MattS423

    .net 2k3 - error writing to program database

    Simple soultion: 1) close the IDE 2) go to the Visual Studio Projects folder where all the compilers files about your program are. 3) find the file it's complaining about 4) delete it. 5) restart visual studio.
  11. MattS423

    MessageBox() problem!

    hDlgMain should be the non-modal dlg box. This is the parent of hWndDlg. No, the line MessageBox(NULL,"Are you sure you want to save changes?", "Confirm", MB_YESNO); spawns a message box that does not have the focus. No, i do not plan on doing the message pump for this message box myself. I'm not using MFC, so AfxMessageBox() isn't gonna help. [Edited by - MattS423 on June 30, 2004 9:39:54 PM]
  12. MattS423

    MessageBox() problem!

    None of the past 3 worked. I looked the window using Spy++ and here's what i found: 1) No windows have WS_SYSTEMMODAL set 2) No windows are topmost 3) My modal dialog box has WS_CONTROLPARENT set. 4) The windows have WS_DISABLED set during the MessageBox() call 5) The caption for the modal dialog box isn't comming through right. Anything?
  13. MattS423

    MessageBox() problem!

    No, no, and no with them both together.
  14. MattS423

    MessageBox() problem!

    Didn't work. I also tried using MB_SETFOREGROUND to no avail.
  15. MattS423

    MessageBox() problem!

    OK, I have a parentless Dialog box (hDlgMain). The user clicks a button. This spawns a Modal dialog box (hWndDlg) who's parent is hDlgMain. The user clicks "OK". I need to confirm stuff before i save, so i do this: case IDOK: lbCapturedIndex = GetDlgItem(hWndDlg,IDC_LIST_CAPTUREINDEX); //list box stuff ret = SendMessage(lbCapturedIndex,LB_RESETCONTENT,0,0); ret = IsWindow(hWndDlg); //make sure this is a valid window EndDialog(hWndDlg,1); // hDlgMain if(MessageBox(hDlgMain,"Are you sure you want to save changes?","Confirm",MB_YESNO) == IDYES) { FindPlayer(Player.IDCode,FoundPlayer); CopyPlayer(Players[FoundPlayer],Player); } break; The message box pops up, and then you can't click on it, probably because the focus isn't set on the message box. you have to ctrl-alt-del out of it. Any ideas on how to make this work?
  • Advertisement
×

Important Information

By using GameDev.net, you agree to our community Guidelines, Terms of Use, and Privacy Policy.

GameDev.net is your game development community. Create an account for your GameDev Portfolio and participate in the largest developer community in the games industry.

Sign me up!