Question about java-based server app frameworks
Hello, I am working on a Java applet application and would like to choose a Java-based scalable server framework to use within my applcation. I have found a few like xsocket or QuickServer and have a question about other. And, also, which is the one You may advise? Yours sincerely, Slawek
For online gaming server. I first heard of xsocket and started using this, but have the problem with NAT. I now know that I need to initiate connections from client behind NAT (server has a public IP) and send messages from server to client within the same connection. I am doing this the following way (as shown in examples- below), but it appears that server receives messages, but client doesnt. I dont listen on any ports in client application and just need to take advantage of the connection initiated (information go from client to server properly).
Server-
try{ nbc = pool.getNonBlockingConnection(inetAddress, 8090);
try{ nbc.write("|01|______|02|______|03|______|04|______|05|______|06|______|07|______|08|______|09|______|10|______"); }catch(Exception ee){}
}catch(java.io.IOException f){}
Client-
public boolean onData(INonBlockingConnection nbc) throws IOException,ClosedChannelException,BufferUnderflowException,MaxReadSizeExceededException{
String x = nbc.readStringByLength(100);
System.out.println("S >> C = "+x);
Similar Messages
-
Three questions about Java and Ftp
Hello, i've the following questions about Java and Ftp:
1- .netrc file is in $HOME directory but i can't access to this directory from java code. The following line producesan Exception (directory doesn't exists)
FileWriter file = new FileWriter ("$HOME/.netrc");
2- .netrc file must have the following permissions: -rw- --- --- but when i create the .netrc file the following permissions are on default: -rw- r-- r--, how can i change this permissions? (In java code, i can't use chmod.....)
3- Are there any way to pass parameters to a .netrc file? If i get to do this i needn't change the permissions because i can't modify or create/destroy this file.
Thanks in advanced!!!
Kike1- .netrc file is in $HOME directory but i can't
access to this directory from java code. The
following line producesan Exception (directory
doesn't exists)
FileWriter file = new FileWriter ("$HOME/.netrc");$HOME would have to be replaced by a shell, I don't
think you can use it as part of a legal path.
Instead, use System.getProperty("user.home");
Ok, thanks
2- .netrc file must have the followingpermissions:
-rw- --- --- but when i create the .netrc file the
following permissions are on default: -rw- r--r--,
how can i change this permissions? (In java code,i
can't use chmod.....)Yes, you can: Runtime.exec("chmod ...");
I need to use estrictly the .netrc with -rw- --- --- permissions
Yes, i can use Runtime.exec ("chmod ..."); but i don't like very much this solution because is a slow solution, am i right?
3- Are there any way to pass parameters to a.netrc
file? If i get to do this i needn't change the
permissions because i can't modify orcreate/destroy
this file.I don't think so. Why do you need the .netrc file in
Java at all? Writing a GUI frontend?I want to use automatic ftp in a java program and FTP server, the files and path are not always the same, so i can:
- modify .netrc (for me is the complex option)
- destroy and create a new .netrc (is easier but i have permissions problem)
- use .netrc with parameters but i haven't found any help about it
Thanks for your prompt reply!!!!
Kike -
Two questions about SG300 DHCP server
Hi,
I have two questions about the DHCP server on the SG300:
On the Address Binding page, what does the "Declined" state mean? I have a NAS device that won't pull an address, and I think that the entry with a state of "Declined" corresponds to this device. It was previously pulling an address from a RV180, so the only difference is that it is now connected to the SG300. I worked around this by manually setting the address on the NAS device, but this won't scale if I run into a lot of other devices that can't pull an address.
I configured a static address binding for a WAP321 and found that instead of pulling the configured address that it pulled a dynamic address. I checked the Address Binding page and see that the dynamic entry that corresponds with the WAP321 has a Client Identifier rather than a MAC address. I changed the static entry for the WAP321 to use the client identifier displayed in the dynamic entry, and now the WAP321 pulls the configured static address. Is this expected behavior?
Thanks,
BobWith the SX300/500 it is required the client identifier, it doesn't automatically insert it. If static DHCP is made on the switch and you didn't need client identifier, that is more or less fortunate behavior for you
So to answer this question, the expected behavior is to configure client identifier for static DHCP entry.
-Tom
Please mark answered for helpful posts
http://blogs.cisco.com/smallbusiness/ -
The question about the sharepoint server 2010 install
Hi Friends,
i have a question about the sharepoint server 2010 install.
my computer is used the windows server 2008 service pack 1. in order to install the sharepoint 2010 server, i need to choose to windows server 2008 service pack 2. my question is when i install the windows server 2008 service pack 2,whether the inside
of my computer information will be lost or change?
thank you in advance.
QearlHi ,
No data will be lost either from your Windows program files or other drives as long as it is an upgrade.
After upgrade you will still be able to see your old program files under windows.ol folder in the C: Drive of the new OS.
The data will be lost only when you perform a clean install like complete formatting the HArd disk and installing from scratch.
As mentioned it always good to maintain a backup preferable important files in a skydrive as there is a good chance of external drives crashing. -
Question about Java's HttpServer: Threading? Backlog?
Hello,
I have two questions about Java's HttpServer (com.sun.net.httpserver). From the JavaDoc:
>
Management of threads can be done external to this object by providing a Executor object. If none is provided a default implementation is used.
>
How can I get information about the default implementation in 1.6.0_13? Do you know the behavior? From my observations, the default implementation uses no Threads, meaning every request is handled in the same Thread, this results in handling the requests to the HttpServer one after another.
Is this right?
The second question is about this, also from the JavaDoc:
>
When binding to an address and port number, the application can also specify an integer backlog parameter. This represents the maximum number of incoming TCP connections which the system will queue internally. [...]
>
When setting the backlog to -1, it uses the systems default backlog. How can I determine the systems default backlog? Can some lines of Java code reveal it (there is no getBeacklog() method)? Or is it up to the Operating System (we use Redhat Linux)?
Thanks a lot for your help!
Regards,
TimoHow can I determine the systems default backlog?You can't. There is no API for that even at the C level.
Can some lines of Java code reveal itNo.
Or is it up to the Operating System (we use Redhat Linux)?Yes. Linux provides a large default. It seems to be at least 50 on most platforms. This is not something you should be worrying about. -
I see lots of people asking questions about the "white screen" app store update failure. I see no answers from Apple about this...What is the problem, and what is the solution?
It's a problem that Apple is having with their App updating system. The best solution is to be patient, and wait for Apple to solve their systemic problem.
-
Question about Java apps structure
Hello guys,
I'm a professional C++ programmer and I would like to start learning Java. I'm reading about Java from here and there and would like to ask you about how a java program is structured compared to C++.
So in C++, I have main.cpp (or any other file name, doesn't matter), which contains a the main() function, and I have .h and .cpp class files that I instantiate (basically) in my main function to get my program to work.
In Java, I'm confused and can't really find the "general" rule to how stuff are organised. I noticed that every class has a main function (why?), and there's no global scope. And "somehow", file names must exactly be equal to the class names.
The question is: how are Java files of classes (and other stuff, if available) are arranged to create a program? What's the standard why? And How can I have many classes together in a single main()?
Thank you for any efforts :-)
Edited by: 927494 on 13.04.2012 07:02
Edited by: 927494 on 13.04.2012 09:10Thank you guys for the replies. I still have some more doubts :-)
Do I have to have a file for the implementation and a file for the definitons, like cpp and header files? or just everything inside the class?
Why does Netbeans fail to compile when I change the class name? what should I change with the class name in general to have it compile correctly? From what I understand till now, the top level class's name (the class with the main() function that's gonna be executed) has to be equal to the file name (and I got that this is the sufficient condition for the app to compile), while the same file can have more classes if I wish. Did I get that right?
I don't know if I get that right too, we pass only a SINGLE class/file to the compiler, and it automatically resolves ALLLL the included files automatically, unlike C++, where all cpp files have to be passed to the compiler/makefile to create object files, and then the executable is created after linking all those object files with the libraries together. i.e.: Java doesn't really need a makefile because making is really simple with only 1 filename. True? -
Some questions about Java deployment steps and techniques
All my java experience is coding and testing in my local machine (where, of course, a jre is available), but ... when I deploy to other people, they may not have a jre or they may have a different version of it than the one needed to run my application. I've read different stuff online including jars and java web start but still I have many questions.
(1) first one first, Sun contradicts common sense, when it says that i can redistribute my own customized light version of their jre by taking out some files (java.sun.com/j2se/1.5.0/jre/README). there are two ways for me to get a jre: Way one is by downloading one from Sun, the download comes as an *.exe file and I don't see how I can take files out of it, so do you know how?. Way two would be by simply copying the set of files i choose (according to that Readme) from my current jre installation (the one on my \java\jdk\jre directory), does this make sense?, (if you're under windows) doesn't an installed version of a jre need a couple of dlls plus some new registry entries?, this contradicts common sense, if I'm not wrong, that Readme is a nonsense, but since that readme is at each of us jre installation \java\jdk1.x\jre\Readme, it can't be a nonsense, therefore I'm wrong, therefore the answer is either Way 1 or Way 2, HOW? ... or maybe there's a Way 3?
(2) Say I never read that Readme so I download the jre (as an exe) to bundle it along with my application in a jar ... now I'll give my neighbor either a jar with two exes or two exes jars ... is there a way to make a jar so that two files get executed? ... if the answer is No and I have competition from a second neighbor, then I believe I'm asking my first neighbor to choose my application based on our friendship, that's not reasonable if we are doing business, so Java loses.
(3) Say that my application is a single executable file like this,
class X{
public static void main(String[]$$$){
System.out.println("Console, where are you?");
At this point, say that my neighbor accepted the two executables, he executed the jre.exe and has jre6 in his system, now he double clicks on my X.jar ... it's a console application and jar files are not associated with the java.exe launcher since java 5, but with javaw which doesn't open any console ... how do i make it so a console opens and prints "Console, where are you?" ... do I ask my neighbor-customer to add a couple of lines to his path and open his console and (please) enter java -jar jarfile.jar? ... isn't it too much? ... i hope i'm wrong cause this is kind of discouraging
(4) I've read that by installing a more recent version of a jre on a system that has an older jre (there to help other applications work), I might be causing a problem for the other applications to run ... I guess that's the reason why that Readme kind of encourage to redistribute a "private" version of a jre (one that doesn't come with a java.exe launcher ... any feedback on this?
(5) I'm reading a lot of hype about Java Web Start ... it looks better than the traditional jar/jre deployment ... but setting up a MIME type to *.jnlp, it doesn't come with some free hosting I've checked ... somebody can recommend a free hosting service that allows to set a *.jnlp MIME? (I'll appreciate a suggestion here, cause I would like to test Web Start)... and, anyhow, how you people compare it with the paradigm of the single executable file?.
Thanks. Your feedback is highly appreciated.jorgelbanda wrote:
..(5) I'm reading a lot of hype about Java Web Start ... It's gratifying to think that someone who wants to deploy apps., has the common sense to search first! You would not guess how I often I hear "I wanna' make an EXE" shortly followed by "What's webstart?".
...it looks better than the traditional jar/jre deployment ... but setting up a MIME type to .jnlp, it doesn't come with some free hosting I've checked ... OK. You cannot define new mime types, but perhaps the site already has it defined. An easy way to check is to upload 'any old file' that ends in .jnlp and use the [mime type checker|http://pscode.org/mime/] to see what content type it is served as.
..somebody can recommend a free hosting service that allows to set a .jnlp MIME? (I'll appreciate a suggestion here, cause I would like to test Web Start)... I'm pretty sure the Google based sites offer it.
Note that I edited the asterisks out of your post, to avoid the forum software parsing half the reply as bold. -
Questions about Java Servlets and JSP
Hi,
I'm a confident Java Programmer (and really enjoy using this language) but am very new to Java servlets and Java Server Pages.
I have previously worked with Perl on my web projects (simple 'league' style voting pages). I read in my 'Core Java' book that I should no longer use perl or even cgi.
I need to know more about Java servlets and Java Server Pages so I can make the switch to a 'real' programming language.
I have a few questions:
How should I start to learn JS and JSP?
How applicable will the java knowlegdge I have already be?
Are JSP common on the world wide web?
What tools do I need to start? (I currently develop in JBuilder and have Java 1.4.1 Standard Edition)
Is it likey my web host (and others) will support JSP?
Thank-you very much for helping a novice get started,
Regards,
PaulHi, Steve ...has to be frustrating! But do not despair.
Let's suppose the servlet it's named MyServlet on package org.servlets
WEB-INF should look:
WEB-INF
classes
org
servlets
MyServlet.class
web.xml
web.xml file should have this two declarations:
<web-app>
<servlet>
<servlet-name>MyServlet</servlet-name>
<servlet-class>org.servlets.MyServlet</servlet-class>
</servlet>
<!-- other servlets -->
<servlet-mapping>
<servlet-name>MyServlet</servlet-name>
<url-pattern>/MyServlet</url-pattern>
</servlet-mapping>
<!-- other servlets mappings -->
</web-app>Now, once the container starts (Tomcat?), you should be able to see that servlet in:
http://localhost:8080/[my-context/]MyServletAnd what my-context is? The web application context. This string should be empty if your're deploying to the root context, otherwise should the context name. In Tomcat, deploying to root context defaults to using webapps/ROOT.
Sorry for my English, but I felt the need to answer your request. I hope it helps despite my writing. -
Hello,
I was wondering how to write a Makefile that can create scripts (in bash) to launch programs? E.g. I have client.java and server.java, I know how to write a Makefile to compile them, but how can I use the Makefile to create a script to run them? Many thanks for any help.
ArjinHi,
It doesn't sound like you are asking a Java question even if you are using / having java classes. You probably get better and faster replies if you ask that in a mailing list or a forum that is related to make files.
Kaj
Ps. Most Java applications are built using Ant or Maven. -
I have some questions about some java errors
1. what kind of errors are contained in Error class?
2.does this class contain only runtime errors?
3. if the question number 2 is positive, what about InstantiationError which is a compile error and is a subclass of Error.
4.When our program is out of memory, which processes are done for an error to be produced. is the error actually from OS or VM?I have some questions about some java errors
1. what kind of errors are contained in Error class?An Error is a subclass of Throwable that indicates serious problems that a reasonable application should not try to catch.
2.does this class contain only runtime errors?No
3. if the question number 2 is positive, what about
InstantiationError which is a compile error and is a
subclass of Error.
4.When our program is out of memory, which processes
are done for an error to be produced. is the error
actually from OS or VM?Various - both, depending on where the error occurred. -
About java.rmi.server.UnicastRemoteObject
Hi friends
Just now I started studying about RMI. In Implementing Remote Interface class we extends java.rmi.server.UnicastRemoteObject class we also have java.server.RemoteObject also why we specifically extends UnicastRemoteObject what is the significance of it
can anyone help me plz
thank uUnicastRemoteObject is a base class that can make your object a remote object. (If you create an object that DOESN'T extend UnicastRemoteObject, then it's methods cannot be accessed remotely.
-
Question about VPN with Server 2012
I am a programmer, but I know enough about network and server configs to be slightly dangerous when it comes to configurations.
My task today was to try to setup VPN access at our office. We have a 2012R2 standard server that was not doing anything (not even on), so I decided it would be the perfect machine for the job.
To make this as short as possible, we are a real small office, 3 guys. We have a high end (although consumer grade) router that is not a VPN end point, but does support VPN tunneling through its firewall. Router is DHCP server, however most workstations
and servers in the office are setup with statics.
I got everything to work (pats self on back) to allow me to create a new VPN connection from an outside Windows client machine, and everything worked as I wanted it to, except for machine name resolution. I understand this is due to limitations in NetBIOS
and how that all works. I found an article about setting up a WINS server, and once I did that, it resolved my issue and I was able to connect to shares or RDP to machines by name instead of by local IP address.
So I came here to ask this:
1) The WINS server method required me to manually add each machine/IP I wanted to register. I am not sure why this is, but I am thinking it has to do with the server not acting as the DHCP/DNS server (or maybe this is just how WINS works?). This isn't a
HUGE deal, but it would be nice if I didn't have to manually manage this list. If Windows clients on the local network here can broadcast and see all available network machines, why can't the WINS server make the same network crawl automatically?
2) In reading about the WINS server, most people said it was a relic and one should use DNS instead. I am looking for more information on this, to see if this is something I should consider or worry about.
3) Would I make my life easier if I made the 2012 server both DHCP and DNS server and removed those tasks from the router?
A side note if it matters, we are NOT on a domain here, just a loose set of workgroup machines. We find that setting up a whole DC and adding all these machines and accounts to a domain is counter productive for us, because we are such a small shop here,
with nothing to restrict from each other, and we find that adding a domain into the picture complicates things more than it simplifies things. Of course unless someone can make a case why we should just move to being on a DC.
Matt Kleinwaks - MSMVP MSDN Forums Moderator - www.zerosandtheone.comHi,
There have the Browser Elections procedure when you use WINS service, but the WINS service in domain environment and workgroup environment have the different Browser Election.
By default, all domain controllers in a domain are browser servers.
You can refer the following KB to understand the procedure:
Browser Elections
http://technet.microsoft.com/en-us/library/cc959896.aspx
How Computer Browser Service Works
http://technet.microsoft.com/en-us/library/cc737661(v=ws.10).aspx
Description of the Microsoft Computer Browser Service
http://support.microsoft.com/kb/188001
If you install a WINS server the WINS server will handles name registration requests from WINS clients, register their names and IP addresses, and responds to NetBIOS name
queries submitted by clients, returning the IP address of a queried name if it is listed in the server database.
WINS provides the following benefits for administering your TCP/IP-based network:
A dynamic name-to-address database that maintains support for computer name registration and resolution.
Centralized management of the name-to-address database, alleviating the need for managing Lmhosts files.
Reduction of NetBIOS-based broadcast traffic on subnets, by permitting clients to query WINS servers to directly locate remote systems.
Support for earlier Microsoft® Windows® and NetBIOS-based clients on your network, permitting these types of clients to browse lists for remote Windows domains without requiring
a local domain controller to be present on each subnet.
Support for DNS-based clients by enabling those clients to locate NetBIOS resources when WINS lookup integration is implemented.
The related KB:
WINS servers
http://technet.microsoft.com/en-US/library/cc781189
Windows Internet Name Service (WINS) Overview
http://technet.microsoft.com/en-US/us-en/library/cc725802.aspx
Hope this helps. -
Question about Java implementation in Linux platform
Hello,
I shall implement one Java program in Linux platform. I'm a newer to linux. Need I install some special software in Linux platform to compile and run JAVA program?
Thank you in advance
java_linuxSorry, this forum is about Sun Studio, which is a collection of native compilers and tools. About Java, please use Java forum; for example, one of these: http://forums.sun.com/category.jspa?categoryID=5
-
Help! Question about Java Server Pages
Hi everybody!
I'm new to Java, and I wonder if anybody could help me with this:
I need to know the "extension" of this file (I don't physically have the file, I have only its contents!):
</GX>
<GX ID=Beetle>
<BR>
Thank you for choosing <GX TYPE=cell ID=common.Title></GX> for your travel arrangements<BR> <BR>
<GX TYPE=tile ID=resInfo>
Reservation Information<BR>
Reservation Number: <GX TYPE=cell ID=resInfo.recLoc></GX><BR>
</GX>
<BR>
<GX TYPE=tile ID=buyer>
Billing Address<BR>
Buyer: <GX TYPE=cell ID=buyer.name></GX><BR>
<GX TYPE=cell ID=buyer.isResPhone> Residence Phone: <GX TYPE=cell ID=buyer.rPhone></GX><BR></GX>
<GX TYPE=cell ID=buyer.isBizPhone> Business Phone: <GX TYPE=cell ID=buyer.bPhone></GX><BR></GX>
<GX TYPE=cell ID=buyer.isFaxPhone> Fax Phone: <GX TYPE=cell ID=buyer.fPhone></GX><BR></GX>
Address: <GX TYPE=cell ID=buyer.addrOne></GX><BR>
<GX TYPE=cell ID=buyer.isAddr2> <GX TYPE=cell ID=buyer.addrTwo></GX><BR></GX>
City: <GX TYPE=cell ID=buyer.city></GX><BR>
<GX TYPE=cell ID=buyer.isState> State/Province: <GX TYPE=cell ID=buyer.state></GX><BR></GX>
Country: <GX TYPE=cell ID=buyer.country></GX><BR>
<GX TYPE=cell ID=buyer.isPostal> Postal/Zip Code: <GX TYPE=cell ID=buyer.postal></GX><BR></GX>
</GX><GX VISIBLE=false> <!-- end of buyer tile --> </GX>"
After many searches on the web, I can't find out if it's a HTML or GXML template, or if it has to do with JSP (is it a .jsp web page?)
Thanks in advance!Thanks very much both of you for your prompt help!
I had already found this link but now with your explanations, it seems a bit clearer now...
After another search, it seems that this file is a HTML or GXML template to be rendered by a template engine (I've read that GXML templates only contain GX tags like my file) . Does it sound familiar to you?
I need now to know which extension would have this file it is were like I believe a HTML or GXML template? Will it have simply a .html or .gxml suffix?
Many thanks in advance!
Maybe you are looking for
-
Copy transfer structure transfer rules from one client to other client
Hi Our R3 client 100 is mapped to BW client 100. R3 client 100 is source system in BW. As the master data is created by users in R3 client 200 we want to get the data from client 200 to BW. We dont want to replicate each datasource and do all stuff f
-
Hi guru We used SAP MDM 5.5 SP 6 (64.92) In workflow we use e-mail notification, when SAP MDM Server work without LDAP e-mail is sending. When we load SAP MDM Server with LDAP, every time when we send e-mail we get error "Could not send e-mail " Send
-
Use block processor to perform lookups in alternate HFM app
Hi All, I would like to use the block processor to perform attribute lookups (using functions such as GetCustomTopMember, etc) on an alternate application (ie: not the one that is connected to the FDM app in the adapter). We are pulling data out of o
-
SM35 - How to download the log!!!!!!!!
Hello experts, Can anyone guide me how to download the log from SM35. Previously I saw some thread in SDN, someone developed a program to download the log... can anyone paste the code... if have any... Thanks a lot in advanse... I really appreciate y
-
Using iMovie '11 with iPhoto '09
Now that you can buy iMovie '11 separately from the new App Store, is it safe to assume that it's perfectly compatible with versions of apps from earlier iLife suites - eg. iPhoto '09?