Re: JDK 1.1.6 Version 4a and VolanoMark 2.0
John Neffenger wrote: > Linux JDK 1.1.6 v4a 317, 321, 319 320 (+ 37%) Thanks John for updating us with the new results! Great, we're now neck and neck with that speed demon, MRJ 2.0 :-) Does the the Volano benchmark run with the TYA JIT (http://www.tya.home.ml.org)? Or for that matter with Kaffe (http://www.kaffe.org)? Haven't seen any Volano results posted for those VM's... - Dan
Re: JDK 1.1.6 Version 4a and VolanoMark 2.0
Hi Dan, > Thanks John for updating us with the new results! > Great, we're now neck and neck with that speed demon, MRJ 2.0 :-) It looks as if FreeBSD's JDK 1.1.6 port is the same speed (for VolanoMark) as their JDK 1.1.5, but they also fixed that nasty socket timeout bug I was hitting on both Linux and FreeBSD. Microsoft's and Tower's latest releases are coming up a bit slower than before, but not enough to matter. Actually, the connection scalability on Linux -- not speed -- is the bottleneck for now. Even after I rebuilt my Red Hat Linux 4.2 kernel for 1024 file descriptors per process, I was unable to get over about 250 connections to the VolanoChat server. TowerJ 2.1.2 could get up to about 350 connections on the same machine. Is there a limit on file descriptors built into the Linux Java VM or its libraries somewhere? I followed the instructions at: http://www.volano.net/guide/linux.html I haven't tried more than 200 connections on Red Hat Linux 5.1 yet. The default limit is increased to 1024 in the kernel for version 2.1, right? > Does the the Volano benchmark run > with the TYA JIT (http://www.tya.home.ml.org)? I haven't tried it yet. > Or for that matter with Kaffe (http://www.kaffe.org)? Kaffe can't run VolanoMark (nor our product, VolanoChat), but Tim Wilkinson at Transvirtual Technologies is working on it. John Neffenger
Test - ignore:)
Just testing before I write a nice long mail all about firewall tunneling:) -- John Baker, Software Engineer, Java coder, Salad sarnie lover. Work: (01203) 562000 ext 4153 Home: (01203) 601890
some problems with rxtx-1.2pre5
Michael, I have not had time to download the pre5 release yet so cannot check the line number (my changes were merged with others). However, a printout of the compiler error would be useful. Also, I suspect the BlackBox you are using is for an old version of commapi as openPort() was replaced with open() in commapi2.0. Dave > Mr. Atkinson > > I downloaded and built the rxtx-1.2pre5 package. I followed your readme > file and used the comm.jar file > from."javacomm20-beta-solaris-sparc_tar.z". > > When I initially tried to build the package I got an error relative to > "tt" in file SerialImp.c at line 2180. I commented out the offending > lines to get the package to build. > > When Testing with the comm.jar file from > "javacomm20-beta-solaris-sparc_tar.z" I get the following error. > > java BlackBox -p /dev/cua3 > > CommAPI pre-release version. Do not distribute. > Opening port /dev/cua3 > java.lang.NoSuchMethodError: javax.comm.CommPortIdentifier: method > openPort(Ljava/lang/String;I)Ljavax/comm/CommPort; not found > at SerialPortDisplay.openPort(SerialPortDisplay.java:133) > at SerialPortDisplay.(SerialPortDisplay.java:114) > at BlackBox.addPort(BlackBox.java:277) > at BlackBox.main(BlackBox.java:170) > > > When I replace the comm.jar file one I previously used the BlackBox demo > runs, but with no receive functionality as with the previous version of > rxtx I built (rxtx-1.2pre3). I have also run the SerialDemo with the > same results as above. When running both demos under release 1.2pre3 > the transmit functionality works but not the receive. I understand this > is due to the eventlistners not beign enabled in the early release. > > Questions: > > what could be causing the errors mentioned above. > Are the eventlistenres enabled in release 1.2pre5, so the receive > functionlity should work in the demos? > What should I do to properly build the system? > > Any help will be greatly appreciated. > > Thank You > > Michael Cianciosi > >
URLConnection
Hiya,
I've been messing about with firewall tunneling recently, but am having
massive problems with URLConnection. It seems that there is one combination
of sequence of events and streams used which actually makes it work.. take
the Post method for example.. the online docs say the client should do the
following:
private final String serverURLin = new String("http://localhost:9876/");
private URLConnection urlConClientIn;
private PrintStream clientOutStream;
urlConClientOut = (new URL(serverURLin)).openConnection();
urlConClientOut.setDoOutput(true);
urlConClientOut.setUseCaches(false);
clientOutStream = new PrintStream( urlConClientOut.getOutputStream() );
clientOutStream.println("Linux");
clientOutStream.println("Is");
clientOutStream.println("Lovely");
clientOutStream.close();
Yet this doesnt seem to send anything to the server. Now I know the server
is running ok because by entering http://localhost:9876/ in netscape, it
connects and the server gets all the header information from the url
request.. so what's wrong with that client?
Here is the server code I have:
private Socket socketIn;
private DataInputStream sInStream;
sInStream = new DataInputStream
(new BufferedInputStream(socketIn.getInputStream()));
int contentLength = 0;
String inStr;
// Read the headers
do
{
inStr = sInStream.readLine();
System.out.println(inStr);
// if inStr has Content-length, read the
// length into a variable here
if (inStr.startsWith("Content-length:"))
{
String s =
inStr.substring(16, inStr.length());
System.out.println("Got clength "+s);
contentLength = Integer.parseInt(s.trim());
}
} while (!inStr.equals (""));
But it always gets 'stuck' at the sInStream.readLine() !
If anyone has any pointers, or working code which does roughly the same
as this, please help!
Ta,
John Baker
--
John Baker, Software Engineer, Java coder, Salad sarnie lover.
Work: (01203) 562000 ext 4153
Home: (01203) 601890
AudioPlayer
Hi All, Has anyone come across a way of detecting when an AudioPlayer has finished playing it's input stream ? I could subclass the input stream to detect this, but there might me a more elegant solution. Thanks Jerry T
help: math lib problem with javakey
Hi, When I first installed the JDK I had the green_threads problem which I solved by heeding the advice of whoever (forget now, but thanks!!) to delete the files: libc.so.5 and libdl.so.1 Now I am ddoing some applet stuff aaand would like to sign some jar files. When I try and generate the keys the complaint is: /usr/local/jdk1.1.6v4a/bin/../bin/i586/green_threads/java: can't resolve symbol '__eprintf' Unable to resolve symbol (libmath.so) java.lang.UnsatisfiedLinkError: no math in shared library path Can anyone help. Thanks, Rob I am running the latest Walnut Creek Slackware 3.5 release and ldd /usr/local/jdk1.1.6v4a/bin/i686/green_threads/java ( results in: libjava.so => /usr/local/jdk1.1.6v4a/lib/i686/green_threads/libjava.so (0x4000a000) libm.so.5 => /lib/libm.so.5 (0x4007a000) libdl.so.1 => /lib/libdl.so.1 (0x40083000) libawt.so => /usr/local/jdk1.1.6v4a/lib/i686/green_threads/libawt.so (0x40086000) libXpm.so.4 => /usr/X11R6/lib/libXpm.so.4 (0x400cf000) libXt.so.6 => /usr/X11R6/lib/libXt.so.6 (0x400de000) libICE.so.6 => /usr/X11R6/lib/libICE.so.6 (0x4011c000) libSM.so.6 => /usr/X11R6/lib/libSM.so.6 (0x4013) libXext.so.6 => /usr/X11R6/lib/libXext.so.6 (0x40138000) libX11.so.6 => /usr/X11R6/lib/libX11.so.6 (0x40142000) libXp.so.6 => /usr/X11R6/lib/libXp.so.6 (0x401d4000) libc.so.5 => /lib/libc.so.5 (0x401da000) and ldconfig -D ldconfig: version 1.9.9 /usr/local/lib: /usr/X11R6/lib: libgtk.so.1 => libgtk.so.1.0.2 libglib.so.1 => libglib.so.1.0.2 libgdk.so.1 => libgdk.so.1.0.2 libgimpui.so.1 => libgimpui.so.1.0.0 libgimp.so.1 => libgimp.so.1.0.0 libgck.so.1 => libgck.so.1.0.0 libXpm.so.4 => libXpm.so.4.11 libXaw3d.so.6 => libXaw3d.so.6.1 libXtst.so.6 => libXtst.so.6.1 libXt.so.6 => libXt.so.6.0 libXp.so.6 => libXp.so.6.2 libXmu.so.6 => libXmu.so.6.0 libXi.so.6 => libXi.so.6.0 libXext.so.6 => libXext.so.6.3 libXaw.so.6 => libXaw.so.6.1 libXIE.so.6 => libXIE.so.6.0 libX11.so.6 => libX11.so.6.1 libSM.so.6 => libSM.so.6.0 libPEX5.so.6 => libPEX5.so.6.0 libICE.so.6 => libICE.so.6.3 libXm.so.1 => libXm.so.1.2.0 libMrm.so.1 => libMrm.so.1.2.0 /usr/ix86-linux/lib: /usr/ix86-linuxaout/lib: libPEX5.so.6 => libPEX5.so.6.0 libXpm.so.4 => libXpm.so.4.3 libXt.so.6 => libXt.so.6.0 libXaw.so.6 => libXaw.so.6.0 libXIE.so.6 => libXIE.so.6.0 libX11.so.6 => libX11.so.6.0 libXt.so.3 => libXt.so.3.1.0 libXaw.so.3 => libXaw.so.3.1.0 libX11.so.3 => libX11.so.3.1.0 libdb.so.1 => libdb.so.1.85.1 libvga.so.1 => libvga.so.1.2.9 /usr/openwin/lib: libxview.so.3 => libxview.so.3.2.2 libolgx.so.3 => libolgx.so.3.2.2 /usr/lib: libz.so.1 => libz.so.1.0.2 libtiff.so.3 => libtiff.so.3.4.33 librle.so.1 => librle.so.1.0.0 libppm.so.1 => libppm.so.1.0.0 libpnm.so.1 => libpnm.so.1.0.0 libpng.so.1 => libpng.so.1.0.89 libpgm.so.1 => libpgm.so.1.0.0 libpbm.so.1 => libpbm.so.1.0.0 libjpeg.so.6 => libjpeg.so.6.0.1 libfbm.so.1 => libfbm.so.1.0.0 libtk8.0.so => libtk8.0.so libtkx8.0.2.so => libtkx8.0.2.so libtclx8.0.2.so => libtclx8.0.2.so libtcl8.0.so => libtcl8.0.so libpanel.so.3.4 => libpanel.so.1.9.9g libmenu.so.3.4 => libmenu.so.1.9.9g libform.so.3.4 => libform.so.1.9.9g libbfd-2.8.1.0.23.so.0 => libbfd-2.8.1.0.23.so.0.0.0 libopcodes-2.8.1.0.23.so.0 => libopcodes-2.8.1.0.23.so.0.0.0 libgpm.so.1 => libgpm.so.1.13 libstdc++.so.2.8 => libstdc++.so.2.8.0 libdb.so.1 => libdb.so.1.85.4 /lib: libvga.so.1 => libvga.so.1.2.13 libvgagl.so.1 => libvgagl.so.1.2.13 libdl.so.1 => libdl.so.1.9.9 ld-linux.so.1 => ld-linux.so.1.9.9 libtermcap.so.2 => libtermcap.so.2.0.8 libm.so.5 => libm.so.5.0.9 libgdbm.so.1 => libgdbm.so.1.7.3 libcurses.so.1 => libcurses.so.1.0.0 libc.so.5 => libc.so.5.4.44 libncurses.so.3.4 => libncurses.so.1.9.9g libe2p.so.2 => libe2p.so.2.3 libext2fs.so.2 => libext2fs.so.2.3 libss.so.2 => libss.so.2.0 libuuid.so.1 => libuuid.so.1.1 libcom_err.so.2 => libcom_err.so.2.0 libc.so.4 => libc.so.4.7.6 libm.so.4 => libm.so.4.6.27 libcurses.so.0 => libcurses.so.0.1.2
Re: Can't find class etc etc etc.
> After seeing many of these messages roll by day after day I was thinking > that perhaps we should create a mailing list faq of some sort that is > sent to people when they first subscribe answering these basic questions? > > It's not that they are stupid questions, I think they are not well documented [cut] I'm fully agree with you but I think that people so lazy to reading FAQ... Aren't they? ;-) Mail question and waiting for respond is much more easy and comfortable way. And do you know way to protect list from classical question ? Paul
Re: JDK 1.1.6 Version 4a and VolanoMark 2.0
i'd like to try 2.0, but u should note that I am not a part of the blackdown port team. my 116 on an alpha/164LX/533 mhz/linux 2.0.33 with volanomark 1.0 gives these results: Please send this file to [EMAIL PROTECTED] for posting. java.vendor= Sun Microsystems Inc., ported by Randy Chapman and Steve Byrne & Uncle George java.vendor.url= http://java.blackdown.org/java-linux.html java.version = gat:09/22/98-22:20 java.class.version = 45.3 os.name= Linux os.version = 2.0.33 os.arch= alpha VolanoMark version = 1.0 Messages sent = 2000 Messages received = 38000 Total messages = 4 Elapsed time = 92.611 seconds Average throughput = 432 messages per second there is a bug in the threading code that prevents me from saying that this port works perfectly, as there seems to be a race condition in GC code & "monitor" code that tramples on each other. I can up the initial allocation ( so i dont get GC'd ) so that the test runs, but thats no way to run a VM :( gat John Neffenger wrote: > Thanks for the great port in Version 4a! > > If anyone on the Blackdown Java-Linux Porting Team wants a copy of > VolanoMark 2.0, please let me know. >
Re: URLConnection
Here is a code snipet that I'm using that works:
The code is used in a client side Bean from within
an applet.
The only difference I see is that I call
setAllowUserInteraction() on the connection and use
writeBytes(buf) directly on the ouput stream object returned
from UrlConnection.getOutputStream();
Good Luck
Chris. :-)
System.out.println("-- Built cmdstr = " + cmdstr );
// UUENCODE the varibale value list pairs
cmdstr = URLEncoder.encode(cmdstr);
System.out.println("-- Encoded cmdstr = " + cmdstr );
// build the post request now
URL url = new URL("http://" + commandUrlSpec + "/servlet/" +
functionTarget );
System.out.println("-- Created URL Obj from command str: " + url.toString()
);
try
{
// execute the request and get the response from
// the server
URLConnection urlConnection = url.openConnection();
urlConnection.setDoOutput(true);
urlConnection.setDoInput(true);
urlConnection.setAllowUserInteraction(false);
// send the data
DataOutputStream out = new DataOutputStream(urlConnection.getOutputStream());
out.writeBytes(cmdstr);
out.close();
// retreive the response
//DataInputStream urlData = new
DataInputStream(urlConnection.getInputStream());
BufferedReader urlData = new BufferedReader(new
InputStreamReader(urlConnection.getInputStream()));
System.out.println(" got response from sever " );
// the first line tagged with "RESPONSE%" which is the
// return code from the server function
String data ;
boolean bResponseFound = false;
while (( data = urlData.readLine()) != null)
{
// if "#RESPONSE#" tag found process it and set all operations after
// that to build the result set
if(data.startsWith("#RESPONSE#$"))
{
bResponseFound = true;
break;
}// end if
} // end while
urlData.close();
// if
John Baker wrote:
> Hiya,
>
> I've been messing about with firewall tunneling recently, but am having
> massive problems with URLConnection. It seems that there is one combination
> of sequence of events and streams used which actually makes it work.. take
> the Post method for example.. the online docs say the client should do the
> following:
>
>private final String serverURLin = new String("http://localhost:9876/");
>private URLConnection urlConClientIn;
>private PrintStream clientOutStream;
>
>
>
>urlConClientOut = (new URL(serverURLin)).openConnection();
>urlConClientOut.setDoOutput(true);
>urlConClientOut.setUseCaches(false);
>clientOutStream = new PrintStream( urlConClientOut.getOutputStream() );
>clientOutStream.println("Linux");
>clientOutStream.println("Is");
>clientOutStream.println("Lovely");
>clientOutStream.close();
>
> Yet this doesnt seem to send anything to the server. Now I know the server
> is running ok because by entering http://localhost:9876/ in netscape, it
> connects and the server gets all the header information from the url
> request.. so what's wrong with that client?
>
> Here is the server code I have:
>
>private Socket socketIn;
>private DataInputStream sInStream;
>
>
>
>sInStream = new DataInputStream
>(new BufferedInputStream(socketIn.getInputStream()));
>
>int contentLength = 0;
>String inStr;
>
>// Read the headers
>do
>{
> inStr = sInStream.readLine();
> System.out.println(inStr);
> // if inStr has Content-length, read the
> // length into a variable here
> if (inStr.startsWith("Content-length:"))
> {
>String s =
>inStr.substring(16, inStr.length());
>System.out.println("Got clength "+s);
>contentLength = Integer.parseInt(s.trim());
> }
>} while (!inStr.equals (""));
>
>But it always gets 'stuck' at the sInStream.readLine() !
>
>If anyone has any pointers, or working code which does roughly the same
> as this, please help!
>
> Ta,
>
> John Baker
>
> --
> John Baker, Software Engineer, Java coder, Salad sarnie lover.
> Work: (01203) 562000 ext 4153
> Home: (01203) 601890
Re: VISIBROKER FOR LINUX
On Wed, Sep 23, 1998 at 11:20:05, Todd R. Palmer said: > > Is there a version of VISIBROKER for Linux? > > Visibroker for Java will run on the Linux JVM. It is a 100% pure java > CORBA implimentation. The ORB's and services are all implimented > in Java, and yes it includes a idl2java and a java2idl compilers. > > Visigenic was bought by Borland and together they changed their > name to Inprise. Check out > http://www.inprise.com/visibroker/ There is one small thing that should be admitted though. If you plan on using OSAgent, I hope you have a Windows or Solaris box around. Unfortunatley, OSAgent is not 100% java, so it needs to run native. As an aside, I've talked to Inprise/Visigenic and they say they have Visibroker for Linux on their plate, but they don't have any delivery time for it. Rumor has it that some of their code geeks have it running internally, but the marketing folks Just Don't Get It (tm) that there is a market. Drop their sales people a nice note explaining that you would be willing to pay for and use such a product. They missed out on a huge sale from my current client as my client is looking to go to doing most of their java/CORBA/servlet development on Linux, but had deceided to go with RMI for now. Keith -- Keith T. Garner [EMAIL PROTECTED] STR Consultant http://www.str.com/ [EMAIL PROTECTED] "Its hard to play pin the tail on the donkey when its running around kicking you." -- Illinois Little Lotto radio commercial
Re: Can't find class etc etc etc.
> > I'm fully agree with you but I think that people so lazy to reading > FAQ... Aren't they? ;-) ... Isn't is good idea to ask Karl to include 1. Link to http://www.blackdown.org/java-linux/docs/faq/FAQ-java-linux.html 2. Instruction about how to unsubscribe from this list To the footer of each letter distributing via this maillist? Just my 2 cents. All the Best Pavel
socket code problem
I have a problem with some socket (server) code but
don't know whether its the code, improper use of sockets,
or the java implementation for linux. The server sends
2 bytes to the client and the client reads them. Then the
client sends a byte to the server and the server reads it.
The problem is that after the server reads its byte, it cannot
then send the client two bytes. The client is written in perl.
What am I missing??
public static void main(String args[]) {
byte inString;
ServerSocketserversocket= null;
Socket clientsocket = null;
DataOutputStream clientsocket_out = null;
DataInputStream clientsocket_in = null;
try {
serversocket = new ServerSocket(4554);
} catch (IOException e) {
}
try {
clientsocket = serversocket.accept();
clientsocket_in = new DataInputStream
(clientsocket.getInputStream());
clientsocket_out = new DataOutputStream
(clientsocket.getOutputStream());
// WORKS, CLIENT READS 2 BYTES ("OK")
clientsocket_out.writeBytes("OK");
// WORKS, CLIENT SENDS 1 BYTE AND SERVER
// GETS IT
inString = clientsocket_in.readByte();
// THIS FAILS, HANGING SERVER AND CLIENT
// CLIENT CANNOT READ THIS BYTE
// try writing again to client a second time
clientsocket_out.writeBytes("PP");
} catch (IOException e) {
}
}
Thanks,
Mark
Re: socket code problem
I'm not positive this will sove your problem, but you might want to try
flushing that OutputStream after you write to it:
clientsocket_out.flush();
-Rob
On Thu, 24 Sep 1998 [EMAIL PROTECTED] wrote:
>
> // THIS FAILS, HANGING SERVER AND CLIENT
> // CLIENT CANNOT READ THIS BYTE
> // try writing again to client a second time
> clientsocket_out.writeBytes("PP");
Re: Versioning -- Linux JDK needs your HELP!
Steve Byrne <[EMAIL PROTECTED]> writes: >We need three simple pieces of >information from you: Note: I am using Red Hat Linux release 4.1. Some weeks ago I tried to upgrade to Red Hat 5.1. But I couldn't get Java to work. So I downgraded back to Red Hat 4.1 and am waiting for you guys to get the problem resolved. >1) Your system's libc version libc.so.5 => /lib/libc.so.5.3.12 >2) Your system's libdl version libdl.so.1 => /lib/libdl.so.1.7.14 >3) Whether you had to remove libc and libdl to make Java work for you > I did not try to remove either. I just temporarily gave up. Norman Shapiro 5011 Mattos Ct Fremont CA 94536-7170 (510) 795-1800 [EMAIL PROTECTED]
Re: VISIBROKER FOR LINUX
> There is one small thing that should be admitted though. If you plan on > using OSAgent, I hope you have a Windows or Solaris box around. > Unfortunatley, OSAgent is not 100% java, so it needs to run native. Oops, forgot about that. I've got another machine running the OSAgent and OAD :-( Fortunately the OSAgent and OAD only have to be running on another machine on the subnet, which for us isn't a real problem. > As an aside, I've talked to Inprise/Visigenic and they say they have > Visibroker for Linux on their plate, but they don't have any delivery time > for it. Rumor has it that some of their code geeks have it running > internally, but the marketing folks Just Don't Get It (tm) that there is a We are an Inprise corporate partner, and at a recent meeting with an Inprise engineer, he confirmed that this is true. The also have JBuilder running on a Linux machine in the R&D lab. The are working with Sun to get JBuilder for Solaris up and running (look for it this fall), but have done a lot of testing and R&D on Linux machines. Hopefully they will release for the Linux market with some prodding! todd =-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-==-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-= We are born naked, wet and hungry. Then things get worse. Todd Palmer Developer CallCenter Technology Inc [EMAIL PROTECTED] http://www.CallCenterTechnology.com =-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-==-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=
socket problems
This problem may have nothing to do with java on linux, but
I thought i might ask and see if anyone knows what is
happening. I am having many problems with sockets in java and I'm not
sure whether I'm missing something or if something else is
wrong.
I have a java server and a C client.
First, the server's DataOutputStream.writeBytes() method seems to be
doing something else in addition to writing bytes to client. I infer
this because the client's "read" function never returns
more than 1 reflecting only 1 byte is being read even though
the server is sending 2 bytes.
***
-- JAVA method called in server --
clientsocket_out.writeBytes("OK");
-- C client function called --
n = read(sockfd, recvline, 15); (n is 1 and recvline
is "O", but n should be 2 and recvline should be "OK")
***
If I use clientsocket_out.write(buf) where buf is a byte
array and buf.length is 2, the C "read" function works just
fine. In this case n is 2 reflecting that 2 bytes were read and
recvline contains the 2 bytes sent by the server.
Anyone have any idea why this is?
Also, no matter what I do, I can't seem to pass more than
1460 bytes to a DataOutputStream (Socket) using the write
method. Lets say I have byte buffer[]=new byte[3] and
I call the method clientsocket_out.write(buf), I expect that
write will write 3 bytes to the dos, but instead the client
reports that only 1460 bytes have been read. Is this because of
TCP MTU or some other limitation?
Thanks,
Mark
RE: socket problems
When programming sockets for TCP it's
important that you never assume that writes and
reads will send or receive everything in one go.
Java seem to take care of the writes but in most other
languages like C and Perl you have to handle partial writes
yourself within a loop.
Client reads return the number of bytes that are currently
available. As soon as the first byte of data arrives the client
is ready to read. It may take many packets at the network
level for the entire message to be transferred or the server may
implement its writes one byte at a time. If the client
is able to read faster than the packets are arriving then the
data will be seen in chunks. If the client is slower than the
network then you may be able to read the entire packet in
one go.
Some system like Java will hide what is happening a the
network level but typically thing to remember are:
1. If writes return the number of bytes written always check
the value and write out what is remanding.
2. Never assume that entire packets will returned by a single
read even if during testing this is always the case.
3. If reads can be interrupted then check the error and restart
the read.
For your problem of only reading one byte it may be a case
that the server is writing Strings one byte at atime. Not very
efficient but there nothing illegal about it. Putting your client
into a loop until all the data is available should fix your problem.
When it comes to network programming learn to
use a monitoring tool like snoop or tcpdump. Even
truss or strace may help show what is happening.
Hope this helps
Ross Mark
PS Anyone know how to do decent quoting within MS outlook?
ie '>' around the original message.
-Original Message-
From: [EMAIL PROTECTED] [SMTP:[EMAIL PROTECTED]]
Sent: Friday, September 25, 1998 7:28 AM
To: [EMAIL PROTECTED]
Subject:socket problems
This problem may have nothing to do with java on linux, but
I thought i might ask and see if anyone knows what is
happening. I am having many problems with sockets in java and I'm not
sure whether I'm missing something or if something else is
wrong.
I have a java server and a C client.
First, the server's DataOutputStream.writeBytes() method seems to be
doing something else in addition to writing bytes to client. I infer
this because the client's "read" function never returns
more than 1 reflecting only 1 byte is being read even though
the server is sending 2 bytes.
***
-- JAVA method called in server --
clientsocket_out.writeBytes("OK");
-- C client function called --
n = read(sockfd, recvline, 15); (n is 1 and recvline
is "O", but n should be 2 and recvline should be "OK")
***
If I use clientsocket_out.write(buf) where buf is a byte
array and buf.length is 2, the C "read" function works just
fine. In this case n is 2 reflecting that 2 bytes were read and
recvline contains the 2 bytes sent by the server.
Anyone have any idea why this is?
Also, no matter what I do, I can't seem to pass more than
1460 bytes to a DataOutputStream (Socket) using the write
method. Lets say I have byte buffer[]=new byte[3] and
I call the method clientsocket_out.write(buf), I expect that
write will write 3 bytes to the dos, but instead the client
reports that only 1460 bytes have been read. Is this because of
TCP MTU or some other limitation?
Thanks,
Mark
RE: socket problems
Ross,
Thanks a lot - you were correct about what was
happening. Your comments were very helpful.
Mark
On Fri, 25 Sep 1998, Ross Mark wrote:
> When programming sockets for TCP it's
> important that you never assume that writes and
> reads will send or receive everything in one go.
> Java seem to take care of the writes but in most other
> languages like C and Perl you have to handle partial writes
> yourself within a loop.
>
> Client reads return the number of bytes that are currently
> available. As soon as the first byte of data arrives the client
> is ready to read. It may take many packets at the network
> level for the entire message to be transferred or the server may
> implement its writes one byte at a time. If the client
> is able to read faster than the packets are arriving then the
> data will be seen in chunks. If the client is slower than the
> network then you may be able to read the entire packet in
> one go.
>
> Some system like Java will hide what is happening a the
> network level but typically thing to remember are:
> 1. If writes return the number of bytes written always check
> the value and write out what is remanding.
> 2. Never assume that entire packets will returned by a single
> read even if during testing this is always the case.
> 3. If reads can be interrupted then check the error and restart
> the read.
>
> For your problem of only reading one byte it may be a case
> that the server is writing Strings one byte at atime. Not very
> efficient but there nothing illegal about it. Putting your client
> into a loop until all the data is available should fix your problem.
>
> When it comes to network programming learn to
> use a monitoring tool like snoop or tcpdump. Even
> truss or strace may help show what is happening.
>
> Hope this helps
>
> Ross Mark
>
> PS Anyone know how to do decent quoting within MS outlook?
> ie '>' around the original message.
> -Original Message-
> From: [EMAIL PROTECTED] [SMTP:[EMAIL PROTECTED]]
> Sent: Friday, September 25, 1998 7:28 AM
> To: [EMAIL PROTECTED]
> Subject: socket problems
>
>
> This problem may have nothing to do with java on linux, but
> I thought i might ask and see if anyone knows what is
> happening. I am having many problems with sockets in java and I'm not
> sure whether I'm missing something or if something else is
> wrong.
>
> I have a java server and a C client.
>
> First, the server's DataOutputStream.writeBytes() method seems to be
> doing something else in addition to writing bytes to client. I infer
> this because the client's "read" function never returns
> more than 1 reflecting only 1 byte is being read even though
> the server is sending 2 bytes.
>
> ***
> -- JAVA method called in server --
> clientsocket_out.writeBytes("OK");
>
> -- C client function called --
> n = read(sockfd, recvline, 15); (n is 1 and recvline
> is "O", but n should be 2 and recvline should be "OK")
>
> ***
>
> If I use clientsocket_out.write(buf) where buf is a byte
> array and buf.length is 2, the C "read" function works just
> fine. In this case n is 2 reflecting that 2 bytes were read and
> recvline contains the 2 bytes sent by the server.
>
> Anyone have any idea why this is?
>
> Also, no matter what I do, I can't seem to pass more than
> 1460 bytes to a DataOutputStream (Socket) using the write
> method. Lets say I have byte buffer[]=new byte[3] and
> I call the method clientsocket_out.write(buf), I expect that
> write will write 3 bytes to the dos, but instead the client
> reports that only 1460 bytes have been read. Is this because of
> TCP MTU or some other limitation?
>
> Thanks,
>
> Mark
>
Versioning
My system: Debian GNU/Linux 2.1 (Slink) Intel Pentium libc.so.6 => /lib/libc.so.6 (0x40157000) and libc.so.6 points to libc-2.0.7.so libdl.so.2 => /lib/libdl.so.2 (0x40028000) and libdl.so.2 point to libdl-2.0.7.so And no, I didn´t have to remove anything. But this may be cause I installed the pre-packaged version of JDK. If I had to remove anything the package maintainer probaly had this done for me. -- Ja ne, Marcus Brito Mailto: [EMAIL PROTECTED] /~\ \ / ASCII ribbon campaign against HTML mail X Campanha da fita ASCII contra mensagens HTML / \
Metrowerks is releasing its JIT source code for Linux
Hi, In case any of you are interested. Metrowerks today announced it would provide its source code to its JIT compiler under a non-commercial source license very similar to that used by Sun's JDK source. This version runs on LinuxPPC and MkLinux right now (it also includes 68k support). Many of the Blackdown porters have volunteered to make ports to the other Linux Platforms. If interested, check out http://www.metrowerks.com (look in the upper left hand corner under News). Thanks, Kevin -- Kevin B. Hendricks Associate Professor, Operations & Information Technology School of Business, College of William & Mary Williamsburg, VA 23187, [EMAIL PROTECTED] http://business.tyler.wm.edu
Re: JDK & native threads
> If you check the Java-Linux bug database (jitterbug) you will see > that I was the one to report this and that Kevin was the one who > did most of the work to address this. Jitterbug ? Is that the "Bug Reporting" page on Blackdown ?
Re: Java interface to MySQL
HI THERE !!! P L E A S E ,,, L E A V E M Y E - M A I L A C C O U N T A L O N E !!! You are sending me hundreds of messages from anybody and nobody ! I am not a garbage bin for so many messages ! I am tired to delete them ! S O , U N S U B S C R I B E M E N O W Dan Kegel wrote: Corey Shelton wrote: > I was told that there's a JAVA web interface for MySQL that works much > better than the one currently in Perl. Could someone point me in the right > direction? Here's my setup (from a post in comp.databases): I needed to do some web database stuff on Linux. I got up and running fairly quickly, so I thought I'd post a note about exactly what packages I installed. The packages I picked were MySQL, Apache, PHP3, JDK1.1.6, JDBC, and Red Hat Linux 5.1. In particular, the RPM's ftp://ftp.redhat.com/pub/contrib/hurricane/i386/apache_php3-1.3b6-1.i386.rpm ftp://ftp.redhat.com/pub/contrib/hurricane/i386/libgd-1.3-2.i386.rpm http://mysql.he.net/Downloads/MySQL-3.21/RPMS/i386/mysql-client-3.21.32a-rh50.1.i386.rpm (You may need to retrieve the RPM's with plain old FTP, not with a web browser. Web browsers tend to get confused by the extension.) plus Java support (these aren't RPM's) ftp://ftp.tux.org/pub/java/JDK-1.1.6/i386/glibc/v4a/jdk1.1.6v4a-i386-glibc.tar.gz http://www.worldserver.com/~mmatthew/mysql/dist/mm.mysql.jdbc-1.1.zip Here's example PHP2 code (pretty easy to convert to PHP3; PHP3 code available several places I can't recall just now): http://www.webtechniques.com/features/1998/01/note/note.shtml All these things seem to be playing together nicely for me. For more info on PHP3, see http://www.php.net/ For more info on MySQL, see http://mysql.he.net/ For more info on Java under Linux, see http://www.blackdown.org/java-linux.html For more info on a jdbc driver for mysql, see http://www.worldserver.com/~mmatthew/mysql/ Be sure to read the MySQL documentation and try out a few examples. The FAQ in the doc really does get you through most common questions. - Dan
Re: Versioning -- Linux JDK needs your HELP!
On my Slackware 3.5 system running jdk1.1.6v4a > > > 1) Your system's libc version libc.so.5 => libc.so.5.4.44 > 2) Your system's libdl version libdl.so.1 => libdl.so.1.9.9 > 3) Whether you had to remove libc and libdl to make Java work for you No. I did not. On my Slackware 3.4 system running jdk1.1.6v2 > > > 1) Your system's libc version libc.so.5 => libc.so.5.4.33 > 2) Your system's libdl version libdl.so.1 => libdl.so.1.9.5 > 3) Whether you had to remove libc and libdl to make Java work for you No. I did not. > -- K.R. Foley Alwan, Inc. [EMAIL PROTECTED]
Re: JDK & native threads
> Gerald Gutierrez writes: >> If you check the Java-Linux bug database (jitterbug) you will see >> that I was the one to report this and that Kevin was the one who >> did most of the work to address this. > Jitterbug ? Is that the "Bug Reporting" page on Blackdown ? Not exaclty, JitterBug (http://samba.anu.edu.au/jitterbug) is a web based bug tracking system. Blackdown is one of the sites running JitterBug. Juergen -- Juergen Kreileder, Universitaet Dortmund, Lehrstuhl Informatik V Baroper Strasse 301, D-44221 Dortmund, Germany Phone: ++49 231/755-5806, Fax: ++49 231/755-5802
Re: Java Makefile [ was Delete all class files ]
On Tue, 22 Sep 1998 [EMAIL PROTECTED] wrote: > > CP = $(ROOT):$$CLASSPATH > > COMPILER = jikes > > VM = java > > COPTIONS = -g -deprecation -depend -d $(ROOT)/classes > > ROPTIONS = -Daxiomroot=$(ROOT) > > > > [a listing of java files here] > > > > %.class: %.java > > cd $(@D); $(COMPILER) $(COPTIONS) -classpath $(CP) $( > If your classes are in a different directory the pattern rule must have the target found there: $(ROOT)/classes/%.class : %.java . I use this same type of method and it works fine. I assume you are using GNU make, because I think it is necessary for 'pattern rules' (vs. the traditional .SUFFIX rules) > > run: $(CLASSES) > > $(VM) $(ROPTIONS) -classpath $(CP) axiomsl.PMRunner > > > > > > > > Any ideas? > > -A. > > Worst still with packaged java source files. However the following > extracts works fo Xsql and me. > > # Makefile > > PROGRAMS = test > > JCLSS1 = \ >xenon/util/ApplicationResources.class \ >test.class > > JSRCS1 = \ >xenon/util/ApplicationResources.java \ >test.java > > > # Set up Java compiler and flags > JAVAC = javac > JAVAC_FLAGS = -deprecation -g > > # Add the suffixes > .SUFFIXES: .class .java > > > # > # Rule to compile `java' files > # > .java.class: > $(JAVAC) $(JAVAC_FLAGS) $< > > all:: $(PROGRAMS) > > # This should rebuild all java classes from source > test:: $(JCLSS1) > > # Run a shell program to generate launcher script > test:: > make-javaruntime-stub test > > ... > > > The command `make all' or `make test' should now work for you. > > > > > Cheers > > Peter > > -- > import java.std.disclaimer.*; // "Dontcha just love the API, baby bop!" > Peter Pilgrim Dept:OTC Derivatives IT, > Deutsche Bank (UK) Ltd, Groundfloor 133 Houndsditch, London, EC3A 7DX > Tel: +44-545-8000 Direct: +44 (0)171-545-9977 Fax: 0171-545-4313 > -=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=- > . -- - -- - -- - -- - -- - -- - -- - -- - -- - -- - -- - -- - -- - -- . Travis Shirk | What does friend mean to you? [EMAIL PROTECTED] | A word so wrongfully abused http://www.pobox.com/~travis | Are you like me, confused finger [EMAIL PROTECTED] for PGP key | All included but you...alone -- Alice In Chains
