aspose file tools*
The moose likes Developer Certification (SCJD/OCMJD) and the fly likes B&S connection to the server Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login


Win a copy of Spring in Action this week in the Spring forum!
JavaRanch » Java Forums » Certification » Developer Certification (SCJD/OCMJD)
Bookmark "B&S connection to the server" Watch "B&S connection to the server" New topic
Author

B&S connection to the server

Lucas cotta
Greenhorn

Joined: Oct 10, 2011
Posts: 21
Hi all!

I'm thinking, in the client mode, let the user fill just the IP address of the server (and port), instead of IP or host name...
But searching the forum, I saw that most people use both options...
Do you guys think I would loose points for this?

Thanks!!
Roberto Perillo
Bartender

Joined: Dec 28, 2007
Posts: 2266
    
    3

Howdy, Lucas!

Well champ, that's what I did. In my config dialog, the user enters the IP address and port number in which the server is running in the given IP address.

I'm not sure, but I think that there should be a mapping host name X IP address somewhere in your OS (i.e. hosts.sam) so the application is able to resolve correctly the host name, right? I never tried that, so I don't know if even that would work...


Cheers, Bob "John Lennon" Perillo
SCJP, SCWCD, SCJD, SCBCD - Daileon: A Tool for Enabling Domain Annotations
Lucas cotta
Greenhorn

Joined: Oct 10, 2011
Posts: 21
Roberto Perillo wrote:Howdy, Lucas!
Well champ, that's what I did. In my config dialog, the user enters the IP address and port number in which the server is running in the given IP address.
I'm not sure, but I think that there should be a mapping host name X IP address somewhere in your OS (i.e. hosts.sam) so the application is able to resolve correctly the host name, right? I never tried that, so I don't know if even that would work...


Yes but I just want to keep the GUI simple and let the user just enter numbers, in a field that will have a mask for IP address (___.___.___.___)

Thanks for the answer!!
Roberto Perillo
Bartender

Joined: Dec 28, 2007
Posts: 2266
    
    3

Lucas cotta wrote:Yes but I just want to keep the GUI simple and let the user just enter numbers, in a field that will have a mask for IP address (___.___.___.___)


Alright champ, that's an approach. What I did is, I created a subclass of PlainDocument, where the user can only insert numbers or a dot. To validate the IP address, I created a custom validator (I had an interface called Validator with a few custom validators).
Roel De Nijs
Bartender

Joined: Jul 19, 2004
Posts: 5407
    
  13

Lucas cotta wrote:in a field that will have a mask for IP address (___.___.___.___)


And what about 192.1.1.252, also a valid IP but it won't fit your input mask


SCJA, SCJP (1.4 | 5.0 | 6.0), SCJD
http://www.javaroe.be/
Lucas cotta
Greenhorn

Joined: Oct 10, 2011
Posts: 21
Roel De Nijs wrote:
And what about 192.1.1.252, also a valid IP but it won't fit your input mask


I was thinking a field similar to the Windows TCP/IPV4 properties window... do you think is a bad idea?

And another question... an interpretation one..
the instructions say that "The new application, using the existing data file format, must allow the CSRs to generate a list of constractors that match a customer's criteria."
But in the database there are SUBcontractors...

so, what my application will search in the database, contractors or subcontractors?

Thanks!!
Roel De Nijs
Bartender

Joined: Jul 19, 2004
Posts: 5407
    
  13

Lucas cotta wrote:I was thinking a field similar to the Windows TCP/IPV4 properties window... do you think is a bad idea?

No, that's just fine

Lucas cotta wrote:so, what my application will search in the database, contractors or subcontractors?

I guess you are asking this question because in your instructions both "contractors" and "subcontractors" are used in the text to explain the specification (and/or data file content). I would stick to "contractors"
 
It is sorta covered in the JavaRanch Style Guide.
 
subject: B&S connection to the server