开发者

Can I run a server/client program like this?

开发者 https://www.devze.com 2022-12-16 11:27 出处:网络
I want to write a yahoo! messenger and I create 2 java applications .one is for \"server\" and the other one is for\" client\" .at first I run the Server开发者_开发问答 application and then I will run

I want to write a yahoo! messenger and I create 2 java applications .one is for "server" and the other one is for" client" .at first I run the Server开发者_开发问答 application and then I will run my GUI frame which is in my client application(So I will run my client application):it will show a frame that gets user name and password from a client . IF the user name and password were correct I will call the method which I create it in my client class which is in my ClientNetwork package(this package is in Client application). Is this a correct way to run this program?


You will need to determine SOME protocol that will be used to communicate between the two programs. Also you most likely need it to be working over TCP/IP.

I would suggest you look into client/server programming. Here is the relevant Sun Java Tutorial page - http://java.sun.com/docs/books/tutorial/networking/sockets/


Also note that the username and password check should be done at the server. It wasn't quite clear from your question where the credentials are checked, but it's crucial not to do it at the client.

Anything that's done at the client can be potentially compromised, and you certainly don't want a malicious user to be able to log in with someone else's name.

0

精彩评论

暂无评论...
验证码 换一张
取 消

关注公众号