Nio write problem: server data sent isn't fully read by client
Hi everyone,
still writing away with my nio server and once again have run into
some problems. Essentially my main problem is that when the server
writes to the client, the write appears to output all the bytes in the
write operation, but the client never accepts them all, even if a
buffer has been manually allocated to the correct size of the data.
As background my server will accept connections. When a connection
is established I register OP_READ on the key. When a OP_READ trigger
occurs the server accepts the clients request, processes it, then
attaches the output to the SelectionKey as a ByteBuffer that has
already been encoded. At this point I then register OP_WRITE on that
SelectionKey (as a side note i'm running this server on XP and had
read that registering OP_READ and OP_WRITE on the same selector was
bad, but then it looked like there was a work around to this) and wait
for an OP_WRITE trigger.
When an OP_WRITE occurs on that key I run a new method (with heavy
influences from the thread: http://forum.java.sun.com/thread.jsp?forum=11&thread=530825 and the taming the nio circus thread) which will grab the attachment and attempt to send it. The code has been written that IF the send cannot complete it should re-attach the remaining bytebuffer to the key and wait for another OP_WRITE to occur so it can send the remainder.
The problem is that whenever I write (and for this test the amount im writing is approx 10100 bytes) the server appears to send it all (by checking the int returned from socketchannel.write()), but at the client end it never reads all the data that is sent.
If i'm using a blocking socket client, then I get a java.net.SocketException: Connection Reset exception, whilst if i'm using a non-blocking client, I get no exception, just not the whole amount of data, even when i've statically allocated a receiving bytebuffer that is big enough.
The following code is a class that is used to do the writing from the server:
/* code for nio write model referenced from:
* http://forum.java.sun.com/thread.jsp?forum=11&thread=530825
class NIOWriteHandler {
private ByteBuffer sendBuffer;
private SelectionKey localSelectionKey;
NIOWriteHandler(SelectionKey currentKey) {
localSelectionKey = currentKey;
public void doWrite() {
localSelectionKey.interestOps(SelectionKey.OP_READ); //deselect write,
sendBuffer = (ByteBuffer)localSelectionKey.attachment();
// perform the writing
SocketChannel writingChannel = (SocketChannel)localSelectionKey.channel();
if (writingChannel.isOpen()) {
int len = 0;
if (sendBuffer.hasRemaining()) {
try {
System.out.println("Sending chunks o data");
len = writingChannel.write(sendBuffer);
System.out.println("value of len: " + len);
} catch (IOException ioe) {
ioe.printStackTrace();
// call close method
System.out.println("CLOSE INVOKED at POINT 8");
closeComplete(localSelectionKey);
System.out.println("Second IF coming...");
if (sendBuffer.hasRemaining()) {
// if we get here then the previous write did not fully
// complete, so need to save data etc
System.out.println("Couldn't send all data this time...");
localSelectionKey.interestOps(SelectionKey.OP_WRITE|SelectionKey.OP_READ);
localSelectionKey.attach(sendBuffer);
} else {
sendBuffer = null;
closeComplete(localSelectionKey);
// write complete at this stage
}This is the basic block client that is incredibly dumb:
import java.net.*;
import java.util.*;
import java.io.*;
import java.nio.charset.*;
import java.nio.channels.*;
import java.nio.*;
import java.nio.ByteBuffer;
public class ServerTest {
/* args 0 - the IP of the machine to connect to
args 1 - the port number
Simple client that connects to a specified IP & port, takes a line
of input via stdin, sends that to the connected machine and prints
out the response.
Error handling and such isn't accounted for.
public static void main (String args[]) throws Exception{
Socket socket = new Socket(args[0], Integer.parseInt(args[1]));
BufferedReader buffRead = new
BufferedReader(new InputStreamReader((socket.getInputStream())));
PrintStream ps =
new PrintStream(socket.getOutputStream());
Charset charset = Charset.forName("ISO-8859-1");
BufferedReader stdin = new BufferedReader(new InputStreamReader(System.in));
System.out.println("[CLIENT]Data to send: ");
String data = stdin.readLine();
ps.println(data);
String returned = buffRead.readLine();
while (returned != null) {
System.out.println(returned);
returned = buffRead.readLine();
System.out.println("[CLIENT]End server response");
buffRead.close();
ps.close();
socket.close();
}And here is the non-blocking basic client (which dosn't actually close at the moment):
import java.net.*;
import java.util.*;
import java.io.*;
import java.nio.charset.*;
import java.nio.channels.*;
import java.nio.*;
public class ServerTestNonBlock {
/* args 0 - the IP of the machine to connect to
args 1 - the port number
Simple client that connects to a specified IP & port, takes a line
of input via stdin, sends that to the connected machine and prints
out the response.
Error handling and such isn't accounted for.
public static void main (String args[]) throws Exception{
InetSocketAddress addr = new InetSocketAddress
(args[0], Integer.parseInt(args[1]));
SocketChannel sc = SocketChannel.open();
sc.configureBlocking(false);
Selector selector = Selector.open();
System.out.println("Starting connection...");
sc.connect(addr);
while(!sc.finishConnect()) {
System.out.println("1,2,3,4 I will keep on counting...");
System.out.println("Connection established..");
Charset charset = Charset.forName("ISO-8859-1");
CharsetEncoder encoder = charset.newEncoder();
sc.register(selector, SelectionKey.OP_READ | SelectionKey.OP_WRITE);
while (true) {
int n = selector.select();
if (n==0) {
continue;
Set keys = selector.selectedKeys();
Iterator it = keys.iterator();
while (it.hasNext()) {
SelectionKey selKey = (SelectionKey)it.next();
if (selKey.isReadable()) {
// time to setup read
ByteBuffer incomingData =
ByteBuffer.allocateDirect(102000);
incomingData.clear();
int count;
while ((count = sc.read(incomingData)) > 0) {
System.out.println("Value of count: " + count);
// reading the data
System.out.println("Count value: " + count);
int pos = incomingData.position();
incomingData.flip();
CharBuffer content = charset.decode(incomingData);
String inData = content.toString();
System.out.println(inData.trim());
System.out.println("[CLIENT]End server response");
System.out.println("Count value: " + count);
System.out.println("Position value: " + pos);
//sc.close();
//break;
if (selKey.isWritable()) {
BufferedReader stdin = new BufferedReader
(new InputStreamReader(System.in));
System.out.println("[CLIENT]Data to send: ");
String data = stdin.readLine();
ByteBuffer byteBufferOut = encoder.encode
(CharBuffer.wrap(data));
int length = sc.write(byteBufferOut);
System.out.println("Wrote: " + length + " bytes.");
selKey.interestOps(SelectionKey.OP_READ);
}I'm kinda stuck at the moment and am making change for the sake of change without getting a good grasp of what is going on. If anyone can provide any help that'd be fantastic. If in the mean time I figgure something out i'll post a response.
If you've gotten this far thanks a bunch for reading :)
Cheers,
Pete
Hi Meesum,
thanks for the reply :)
I'm not convinced this is the error - as i've got two clients listed there, and the odd behaviour from both is that neither is getting through to the last of the data that is sent.
If the null were the problem (which is only checked for in the basic dumb blocking client) i'd be expecting some sort of infinite loop or wait for more data from the server, not an abnormal termination (ala connection reset) from the server. I'll give it a shot anyhow, but I know that under a blocking write operation that that code worked fine.
Thanks again though for the post, has got some of my cogs slowly turning :)
Cheers,
Pete
Similar Messages
-
Insufficient data sent error in Adobe Reader XI and Adobe Reader X
I have an issue that is happening with several users that I support. It is only happening in a specific program that they use. When they open PDFs, they get the message insufficient data sent and then a blank document opens. I noticed that this seemed to be an issue a couple years ago, but it was apparently solved with recent releases of Adobe reader. I have installed and set up Adobe Reader XI and Adobe Reader X, but the results are the same and very intermittent. It can happen when trying to open a document and then not happen 10 seconds later on the same doc. The company that provides the online program blames Adobe. Where do I proceeed from here?
Hello,
unfortunately it's a reserved document. I'll try to reproduce the issue with a different design and, if possible, I'll post a link to it.
Thank you!
Best regards,
SV -
Hello,
I am seeing a weird behavior when performing a write operation on a non-blocking socket channel. The write call completes normally for several write invocations, however when the total number of bytes written exceeds 8K the sending of data grinds to a halt. All subsequent writes take an excessive amount of time to actually send (10+ secs). It seems to send only a few bytes at time once the 8K threshold is reached. Since it is non-blocking the write call returns immediately, however looking at the actual transmission that occurs, it gets transmitted extremely slow. The far-end is consuming all bytes as they come in, so it should not be backing up on the socket, but it seems that it is having trouble sending the data.
Any thoughts or help would be greatly appreciated.
Thanks!I'm also seeing something similar. Did you ever find a resolution to this issue?
-
NIO write flush problem?
Hello there,
I've got a odd problem here, and it's going to be hard to explain so please excuse me if I haven't explained correctly. I'm writing a Java application, which uses nio, with non blocking sockets, to handle its networking. I presumably have a problem with writing data. Quick recap of the problem is that for some reason, data gets concatenated to each other and then sent. So for example, let's say I'd want to send 'hello' and 'there'. What my application sometimes does, is sending 'hellothere' instead of sending 'hello', and then, in a new packet, 'there'.
What now happens on the server side is that it receives 'hellothere' and doesn't know what do with it, while it would have worked fine if they were separated.
This is a snippet coming from the server. This is always running on background (in a thread), in a loop.
synchronized (m_ChangeRequests)
Iterator changes = m_ChangeRequests.iterator();
while (changes.hasNext())
ChangeRequest change = (ChangeRequest)changes.next();
switch (change.getType())
case ChangeRequest.CHANGEOPS:
SelectionKey key = change.getSocket().keyFor(m_Selector);
try
key.interestOps(change.getOps());
catch (NullPointerException e)
disconnectClient(getClientWithChannel(change.getSocket()));
m_ChangeRequests.clear();
// Waiting for events
m_Selector.select(1000);
// Get keys
Set keys = m_Selector.selectedKeys();
Iterator i = keys.iterator();
// For each keys...
while(i.hasNext())
SelectionKey key = (SelectionKey) i.next();
// Remove the current key
i.remove();
// if isAccetable = true
// then a client required a connection
if (!key.isValid())
continue;
if (key.isAcceptable())
accept(key);
else if (key.isReadable())
read(key);
else if (key.isWritable())
write(key);
}Now, I suppose the important method here is write().
private void write(SelectionKey key)
SocketChannel socketChannel = (SocketChannel)key.channel();
synchronized (m_PendingData)
List queue = (List)m_PendingData.get(socketChannel);
while (!queue.isEmpty())
try
ByteBuffer buf = (ByteBuffer)queue.get(0);
System.out.println(socketChannel.write(buf));
if (buf.hasRemaining())
continue;
queue.remove(0);
catch (IOException ioe)
ioe.printStackTrace();
if (queue.isEmpty())
key.interestOps(SelectionKey.OP_READ);
As you can see I'm using a variable m_PendingData there, which is simply a HashMap. There is another important method, which is the send method.
public void send(SocketChannel socket, byte[] data)
synchronized (m_ChangeRequests)
m_ChangeRequests.add(new ChangeRequest(socket, ChangeRequest.CHANGEOPS, SelectionKey.OP_WRITE));
synchronized (m_PendingData)
List queue = (List)m_PendingData.get(socket);
if (queue == null)
queue = new ArrayList();
m_PendingData.put(socket, queue);
queue.add(ByteBuffer.wrap(data));
m_Selector.wakeup();
}You might have noticed the m_ChangeRequests variable. Please see the first code snippet for what it does. It's a LinkedList.
Sorry if I have not explained it clear enough. I suppose this problem could also be in the read method, I assume it is in the write method though.
Thanks,
LarsBasically you can't think of reading and writing to/from sockets in terms of packets - you write some bytes to the socket at one end, and read some bytes at the other. This is true for both blocking and non blocking sockets.
If you want your bytes to be split into meaningful packets, then you have to encode the packet format yourself. A really simple way to do that is to start each message with a fixed number of bytes that contain the number of data bytes in the packet - from your example this would give:
5 hello 5 there
On the reading end, your server will then be able to read the initial byte count of each packet and know how much data is expected. -
Unwrap not unwraping all data sent from server
java client server NIO ssl
At server end send about 50 packets are written using this method:
sendPacket(String packet)
writeBuffer = charSet.encode(packet);
c.ssl.outNetBB.clear();
c.ssl.engine.wrap(writeBuffer, c.ssl.outNetBB);
c.ssl.outNetBB.flip();
//write message to socket channel
while (c.ssl.outNetBB.hasRemaining())
socketChannel.write(c.ssl.outNetBB);
At the client end I read all these packets:
inNetBB.clear();
int bytesread = socketChannel.read(inNetBB);
inNetBB.flip();
requestBB.clear();
res = engine.unwrap(inNetBB, requestBB);
It seems like all the 50 packets are read into inNetBB 6000 bytes
But the unwrap only consumes 70 bytes and produces 100
This first 100 bytes is unencrypted correctly and corresponds exactly to one write of the 50 from the server. I dont know why.
Why am I getting only the first packet of the 50 sent??
[ Ive tried : while inNtBB.hasRemaining for repeated unwraps
but only the first packet is output still ]
TIA
pbutlerIf I'm reading this right, you're writing (wrapping) about 50 separate SSL packets, and then unwrapping just one.
Recall:
The SSLEngine produces/consumes complete SSL/TLS packets only, and
does not store application data internally between calls to wrap()/unwrap().So it looks to me like you need to keep unwrapping the rest of your 5930 bytes to get the remainder of the application data.
[ Ive tried : while inNtBB.hasRemaining for repeated unwraps
but only the first packet is output still ]Are you inadvertantly clearing the inNtBB before you call your additional unwraps?
If you have lots of small packets, you might want to consider buffering them up and wrapping them to the SSLEngine/SocketChannel all at once. You'll pay less in overhead. -
I have problem with data transfer between Windows Server 2012RT and Windows7 (no more than 14kbps) while between Windows Sever 2012RT and Windows8.1 speed is ok.
Hi,
Regarding the issue here, please take a look at the below links to see if they could help:
Slow data transfer speed in Windows 7 or in Windows Server 2008 R2
And a blog here:
Windows Server 2012 slow network/SMB/CIFS problem
Hope this may help
Best regards
Michael
If you have any feedback on our support, please click
here.
Please remember to click “Mark as Answer” on the post that helps you, and to click “Unmark as Answer” if a marked post does not actually answer your question. This can be beneficial to other community members reading the thread. -
Problem in EWA session data sent to SAP
Hi all,
I am trying to finalise EWA for all my SAP production instances. So far I am able to send EWA session to my Solution manager system or to SAP directly (i.e. to O01)
In the solution manager system under the edit Solution option there is a button "setup EWA". After clicking on this and enabling EWA, there is a check box which says "Send to SAP". I have enabled this check box.
Now does this mean that when the EWA session data arrives in the Solution Manager system, it is also sent to SAP ?
This was my understanding of the checkbox. Also when the EWA report arrives in the Solution Manager system, there is an envelope icon against the report. The tooltip of the icon says "Session data sent to SAP". However when I look at the service channel inbox the session is not visible.
Does anyone have any idea what the problem could be ?
regards,
Kevin HillHi all,
This is what SAP had to say.
quote from SAP reply *********
Please note that not every session follows this path:
Satellite system -> Solution Manager system -> SAP.
All red sessions are forwarded like this. If all is well, and the sessions are always rated green and yellow, only 1 session per system is forwarded every 4 weeks. None of these forwarded sessions create Service Messages. We have access to the actual session and data, and the customer already has the corresponding reports in the Solution
Manager System.
The reports sent to SAP are for SAP's records only. They are not sent back through Service Messages. If you send a red report to SAP, SAP will investigate the cause of the red rating and contact you. It is not possible to receive these reports back on the SAP Service
MarketPlace.
The only sessions that create Service Messages are those sent directly to SAP ( without Solution Manager). They are created as per SAP Note 207223, and the session numbers in SDCC start Z...xx.
quote from SAP reply *********
Well that settles it I guess. However it definitely was not clear from the FAQ and the docs. SAP's reply makes sense as there is no reason why the session report should be available in both the Solman system as well in the services messages.
regards,
Kevin Hill -
I have an Apache web server that is configured to proxy a URL to a java server that I have behind the proxy server. My clients send data through a URLConnection to a specific URL in which redirects it to my java server behind the proxy. My java server has a ServerSocket that gets the request from the proxy and then uses the PrintStream to send data back through the proxy to my clients (Which is an applet). I would like to use the NIO non blocking but the problem is when I create a Channel the only thing that can be written on that Socket Chanel is a ByteBuffer. Because it is a ByteBuffer gets passed the proxy server can not handle the request and thus will not forward it on to my clients. PrintStream currently does this for me and allows this to work. Any ideas how I can use NIO channels to write data that a proxy server will be able to understand? I was thinking of using the ftp proxy instead of http proxy and have not tried that yet but then I would have to have my java server understand ftp protocol......Would really just like to do sockets connections with NIO. Any help would be greatfully appreciated.
Here is a good question that I found fixed my problem. Within my application I have a SocketChannel. When writing through a proxy with an HTTP Header in the front of all my data it doesn't seem to go through the proxy server at all. However, when getting a Socket object from my SocketChannel and then using the OutputStream of the Socket (PrintStream api) will end up pushing the data out through the proxy. What isthe difference between using the write method from the SocketChannel compared to getting a Socket object from the SocketChannel and using its OutputStream to write data?
-
Hi im trying to view a simple report , this report have some parameters from a MS Access database.
I configure everything, The ODBCJDBC bridge, the dns System on Windows, etc...
and the problem its like this,
I connect the database, but the schema its empty , i cant map, the dinamic parameters of my report, with my access database.
I have this errors : at same time
1. This report uses a data connection that isn't fully supported by this version of the Crystal Reports designer. You can modify the report in the designer, but the following actions that access this connection will fail: Browse data, verify database, and report preview. We recommend you set the datasource location to a JDBC or Java Result Set data source.
2. Java.lang.RuntimeException: WARNING: Blocked recursive attempt to close part com.businessobjects.crystalreports.integration.eclipse.jspeditor.CRJSPEditor while still in the middle of activating it
at org.eclipse.ui.internal.WorkbenchPage.closeEditors(WorkbenchPage.java:1247)
at org.eclipse.ui.internal.WorkbenchPage.closeEditor(WorkbenchPage.java:1367)
at org.eclipse.ui.internal.EditorPane.doHide(EditorPane.java:61)
at org.eclipse.ui.internal.PartStack.close(PartStack.java:543)
at org.eclipse.ui.internal.EditorStack.close(EditorStack.java:206)
at org.eclipse.ui.internal.PartStack$1.close(PartStack.java:122)
at org.eclipse.ui.internal.presentations.util.TabbedStackPresentation$1.handleEvent(TabbedStackPresentation.java:81)
at org.eclipse.ui.internal.presentations.util.AbstractTabFolder.fireEvent(AbstractTabFolder.java:267)
at org.eclipse.ui.internal.presentations.util.AbstractTabFolder.fireEvent(AbstractTabFolder.java:276)
at org.eclipse.ui.internal.presentations.defaultpresentation.DefaultTabFolder.access$1(DefaultTabFolder.java:1)
at org.eclipse.ui.internal.presentations.defaultpresentation.DefaultTabFolder$1.closeButtonPressed(DefaultTabFolder.java:67)
at org.eclipse.ui.internal.presentations.PaneFolder.notifyCloseListeners(PaneFolder.java:596)
at org.eclipse.ui.internal.presentations.PaneFolder$3.close(PaneFolder.java:189)
at org.eclipse.swt.custom.CTabFolder.onMouse(CTabFolder.java:2159)
at org.eclipse.swt.custom.CTabFolder$1.handleEvent(CTabFolder.java:320)
at org.eclipse.swt.widgets.EventTable.sendEvent(EventTable.java:66)
at org.eclipse.swt.widgets.Widget.sendEvent(Widget.java:938)
at org.eclipse.swt.widgets.Display.runDeferredEvents(Display.java:3682)
at org.eclipse.swt.widgets.Display.readAndDispatch(Display.java:3293)
at org.eclipse.jface.window.Window.runEventLoop(Window.java:820)
at org.eclipse.jface.window.Window.open(Window.java:796)
at org.eclipse.ui.texteditor.AbstractTextEditor.handleEditorInputChanged(AbstractTextEditor.java:4403)
at org.eclipse.ui.texteditor.StatusTextEditor.handleEditorInputChanged(StatusTextEditor.java:220)
at org.eclipse.ui.texteditor.AbstractTextEditor.sanityCheckState(AbstractTextEditor.java:4555)
at org.eclipse.ui.texteditor.StatusTextEditor.sanityCheckState(StatusTextEditor.java:210)
at org.eclipse.ui.texteditor.AbstractTextEditor.safelySanityCheckState(AbstractTextEditor.java:4533)
at org.eclipse.wst.sse.ui.StructuredTextEditor.safelySanityCheckState(StructuredTextEditor.java:2945)
at org.eclipse.ui.texteditor.AbstractTextEditor$ActivationListener.handleActivation(AbstractTextEditor.java:921)
at org.eclipse.ui.texteditor.AbstractTextEditor$ActivationListener.partActivated(AbstractTextEditor.java:879)
at org.eclipse.ui.internal.PartListenerList$1.run(PartListenerList.java:72)
at org.eclipse.core.runtime.SafeRunner.run(SafeRunner.java:37)
at org.eclipse.core.runtime.Platform.run(Platform.java:857)
at org.eclipse.ui.internal.PartListenerList.fireEvent(PartListenerList.java:57)
at org.eclipse.ui.internal.PartListenerList.firePartActivated(PartListenerList.java:70)
at org.eclipse.ui.internal.PartService.firePartActivated(PartService.java:73)
at org.eclipse.ui.internal.PartService.setActivePart(PartService.java:171)
at org.eclipse.ui.internal.WWinPartService.updateActivePart(WWinPartService.java:124)
at org.eclipse.ui.internal.WWinPartService.access$0(WWinPartService.java:115)
at org.eclipse.ui.internal.WWinPartService$1.partDeactivated(WWinPartService.java:48)
at org.eclipse.ui.internal.PartListenerList2$4.run(PartListenerList2.java:113)
at org.eclipse.core.runtime.SafeRunner.run(SafeRunner.java:37)
at org.eclipse.core.runtime.Platform.run(Platform.java:857)
at org.eclipse.ui.internal.PartListenerList2.fireEvent(PartListenerList2.java:53)
at org.eclipse.ui.internal.PartListenerList2.firePartDeactivated(PartListenerList2.java:111)
at org.eclipse.ui.internal.PartService.firePartDeactivated(PartService.java:116)
at org.eclipse.ui.internal.PartService.setActivePart(PartService.java:165)
at org.eclipse.ui.internal.WorkbenchPagePartList.fireActivePartChanged(WorkbenchPagePartList.java:56)
at org.eclipse.ui.internal.PartList.setActivePart(PartList.java:126)
at org.eclipse.ui.internal.WorkbenchPage.setActivePart(WorkbenchPage.java:3402)
at org.eclipse.ui.internal.WorkbenchPage.requestActivation(WorkbenchPage.java:2946)
at org.eclipse.ui.internal.PartPane.requestActivation(PartPane.java:265)
at org.eclipse.ui.internal.EditorPane.requestActivation(EditorPane.java:98)
at org.eclipse.ui.internal.presentations.PresentablePart.setFocus(PresentablePart.java:191)
at org.eclipse.ui.internal.presentations.util.TabbedStackPresentation$1.handleEvent(TabbedStackPresentation.java:92)
at org.eclipse.ui.internal.presentations.util.AbstractTabFolder.fireEvent(AbstractTabFolder.java:267)
at org.eclipse.ui.internal.presentations.util.AbstractTabFolder.fireEvent(AbstractTabFolder.java:272)
at org.eclipse.ui.internal.presentations.util.AbstractTabFolder.handleMouseDown(AbstractTabFolder.java:342)
at org.eclipse.ui.internal.presentations.util.AbstractTabFolder$3.mouseDown(AbstractTabFolder.java:79)
at org.eclipse.swt.widgets.TypedListener.handleEvent(TypedListener.java:178)
at org.eclipse.swt.widgets.EventTable.sendEvent(EventTable.java:66)
at org.eclipse.swt.widgets.Widget.sendEvent(Widget.java:938)
at org.eclipse.swt.widgets.Display.runDeferredEvents(Display.java:3682)
at org.eclipse.swt.widgets.Display.readAndDispatch(Display.java:3293)
at org.eclipse.ui.internal.Workbench.runEventLoop(Workbench.java:2389)
at org.eclipse.ui.internal.Workbench.runUI(Workbench.java:2353)
at org.eclipse.ui.internal.Workbench.access$4(Workbench.java:2219)
at org.eclipse.ui.internal.Workbench$4.run(Workbench.java:466)
at org.eclipse.core.databinding.observable.Realm.runWithDefault(Realm.java:289)
at org.eclipse.ui.internal.Workbench.createAndRunWorkbench(Workbench.java:461)
at org.eclipse.ui.PlatformUI.createAndRunWorkbench(PlatformUI.java:149)
at org.eclipse.ui.internal.ide.application.IDEApplication.start(IDEApplication.java:106)
at org.eclipse.equinox.internal.app.EclipseAppHandle.run(EclipseAppHandle.java:169)
at org.eclipse.core.runtime.internal.adaptor.EclipseAppLauncher.runApplication(EclipseAppLauncher.java:106)
at org.eclipse.core.runtime.internal.adaptor.EclipseAppLauncher.start(EclipseAppLauncher.java:76)
at org.eclipse.core.runtime.adaptor.EclipseStarter.run(EclipseStarter.java:363)
at org.eclipse.core.runtime.adaptor.EclipseStarter.run(EclipseStarter.java:176)
at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
at sun.reflect.NativeMethodAccessorImpl.invoke(Unknown Source)
at sun.reflect.DelegatingMethodAccessorImpl.invoke(Unknown Source)
at java.lang.reflect.Method.invoke(Unknown Source)
at org.eclipse.equinox.launcher.Main.invokeFramework(Main.java:508)
at org.eclipse.equinox.launcher.Main.basicRun(Main.java:447)
at org.eclipse.equinox.launcher.Main.run(Main.java:1173)
!ENTRY com.businessobjects.crystalreports.integration.eclipse 4 4 2008-04-02 15:30:13.788
!MESSAGE Error loading file prueba.rpt
!STACK 0
java.lang.Exception: Error loading file prueba.rpt
at com.businessobjects.integration.eclipse.shared.EclipseLogger.logMessage(Unknown Source)
at com.businessobjects.integration.eclipse.shared.EclipseLogger.handleMessage(Unknown Source)
at com.businessobjects.integration.capabilities.logging.LogManager.message(Unknown Source)
at com.businessobjects.crystalreports.integration.eclipse.wtp.CrystalReportsValidator.validateOneFile(Unknown Source)
at com.businessobjects.crystalreports.integration.eclipse.wtp.CrystalReportsValidator.validate(Unknown Source)
at com.businessobjects.crystalreports.integration.eclipse.wtp.CrystalReportsValidator.validateInJob(Unknown Source)
at org.eclipse.wst.validation.internal.operations.ValidatorJob.run(ValidatorJob.java:75)
at org.eclipse.core.internal.jobs.Worker.run(Worker.java:55)
!SUBENTRY 1 com.businessobjects.crystalreports.integration.eclipse 4 4 2008-04-02 15:30:13.788
!MESSAGE Plug-in Provider:.... Business Objects
!SUBENTRY 1 com.businessobjects.crystalreports.integration.eclipse 4 4 2008-04-02 15:30:13.788
!MESSAGE Plug-in name:.... Crystal Reports Java Development Tools
!SUBENTRY 1 com.businessobjects.crystalreports.integration.eclipse 4 4 2008-04-02 15:30:13.788
!MESSAGE Plug-in ID:.... com.businessobjects.crystalreports.integration.eclipse
!SUBENTRY 1 com.businessobjects.crystalreports.integration.eclipse 4 4 2008-04-02 15:30:13.788
!MESSAGE Version:.... 1.0.4.v1094
!SUBENTRY 1 com.businessobjects.crystalreports.integration.eclipse 4 4 2008-04-02 15:30:13.788
!MESSAGE The error was detected in com.businessobjects.crystalreports.integration.eclipse
Please PEOPLE OF BUSINESS OBJECTS , I need some support , I think the problem its in your plug in
09 April 2008 , let me how much time i need to wait Your support , maybe , ill try jasper Reports, or Birth, it depends on You people of BO
any req -
> [email protected]
thanks to people that can help ...There are some other solutions possible.
1. Get another driver. The only one known is java only so it wont crash. But is not not free.
2. Use a proxy driver. That means that another app actually does the database work. If it crashes you just start it again (which you can do in your main code.) That way it won't take down your server. There are commercial jdbc drivers that claim MS Access but are are really just proxy implementations as an option in this area. -
hello,
I am trying to control a Coherent Cube laser with labview 8.0 (RS232)
I always get the response 'invalid cmd' from the laser.
There is a software furnished by Coherent which works without any problem.
I monitored the datas sent by this software and labview through the serial port but I did not notice any difference.
Have you got an idea? (the baud rates is well configured)Hi,
So your query works but your command doesn't, is this correct?
(Query being the string which starts with ? eg "?S". Command being "Command=<value>" eg CW=1)
If this is correct then you haven't got a problem with your Write because the Query has to seed the "?..." charaters before you can perform the Read.
Therefore the problem is on the exact syntax of the command string. There can't be any spaces between the command, the = and the <value> ie CW=1 not CW = 1.0.
Hope this helps
Regards
Ray Farmer
Regards
Ray Farmer -
Problem sending data with HTTPS using client authentication.
Hi,
I�m tryingto send a message to a secure server using for this client certificate, apparently if I make a GET of "/" (server root) , everything works fine (authentication, and data received), from the moment that I try to ways send data to the "/pvtn " directory i obtain the following error.
This is a sample of the code i�m using:
import com.sun.net.ssl.KeyManagerFactory;
import java.io.BufferedReader;
import java.io.InputStreamReader;
import java.io.OutputStreamWriter;
import java.io.Writer;
import java.net.Socket;
import java.security.*;
import java.security.GeneralSecurityException;
import java.security.Principal;
import java.security.PublicKey;
import java.util.Collection;
import java.util.Date;
import javax.net.ssl.SSLSocket;
import javax.net.ssl.SSLSocketFactory;
import javax.security.cert.*;
import javax.security.cert.X509Certificate;
public class Test
public static final String TARGET_HTTPS_SERVER = "mymachine.mydomain.pt";
public static final int TARGET_HTTPS_PORT = 443;
public static void main(String[] args) throws Exception
System.setProperty("javax.net.ssl.trustStore","/certificados/truststore.txt");
System.setProperty("javax.net.ssl.trustStorePassword","trustpwd");
System.setProperty("javax.net.ssl.keyStore","/certificados/truststore.txt");
System.setProperty("javax.net.ssl.keyStorePassword","trustpwd");
java.security.Security.removeProvider("SunJSSE");
java.security.Security.insertProviderAt(new com.sun.net.ssl.internal.ssl.Provider(),2);
KeyManagerFactory kmf= KeyManagerFactory.getInstance("SunX509", "SunJSSE") ;
//Socket
SSLSocket jsslSoc = (SSLSocket) SSLSocketFactory.getDefault().createSocket(TARGET_HTTPS_SERVER, TARGET_HTTPS_PORT);
String [] ciphers = jsslSoc.getSupportedCipherSuites() ;
//// Select the ciphers you want and put them.
//// Here we will put all availabel ciphers
jsslSoc.setEnabledCipherSuites(ciphers);
//// We are creating socket in client mode
jsslSoc.setUseClientMode(true);
//// Do SSL handshake
jsslSoc.startHandshake();
// Print negotiated cipher
System.out.println("Negotiated Cipher Suite: " + jsslSoc.getSession().getCipherSuite());
System.out.println("");
X509Certificate[] peerCerts = ((javax.net.ssl.SSLSocket)jsslSoc).getSession().getPeerCertificateChain();
if (peerCerts != null)
System.out.println("Printing server information:");
for(int i =0; i < peerCerts.length; i++)
System.out.println("Peer Certificate ["+i+"] Information:");
System.out.println("- Subject: " + peerCerts.getSubjectDN().getName());
System.out.println("- Issuer: " + peerCerts[i].getIssuerDN().getName());
System.out.println("- Version: " + peerCerts[i].getVersion());
System.out.println("- Start Time: " + peerCerts[i].getNotBefore().toString());
System.out.println("- End Time: " + peerCerts[i].getNotAfter().toString());
System.out.println("- Signature Algorithm: " + peerCerts[i].getSigAlgName());
System.out.println("- Serial Number: " + peerCerts[i].getSerialNumber());
else
System.out.println("Failed to get peer certificates");
try
Writer out = new OutputStreamWriter(jsslSoc.getOutputStream(), "ISO-8859-1");
//THIS WAY WORKS FINE
out.write("GET / HTTP/1.1\r\n");
// HERE COMES THE TROUBLES
//out.write("GET /pvtn?someparameter=paramvalue HTTP/1.1\r\n");
out.write("Host: " + TARGET_HTTPS_SERVER + ":" + TARGET_HTTPS_PORT + "\r\n");
out.write("Proxy-Connection: Keep-Alive\r\n");
out.write("User-Agent: SSL-TEST \r\n");
out.write("\r\n");
out.flush();
BufferedReader in = new BufferedReader(new InputStreamReader(jsslSoc.getInputStream(), "ISO-8859-1"));
String line = null;
while ((line = in.readLine()) != null)
System.out.println(line);
finally
jsslSoc.close();
the ssl log until sending the GET is
main, WRITE: SSL v3.1 Handshake, length = 36
main, READ: SSL v3.1 Change Cipher Spec, length = 1
main, READ: SSL v3.1 Handshake, length = 36
Plaintext after DECRYPTION: len = 36
0000: 14 00 00 0C 71 AB 40 CC 6C 33 92 05 E9 69 4B 8F [email protected].
0010: D1 77 3F 6E 3C DB F0 A0 B7 9C CF 49 B6 6D C8 17 .w?n<......I.m..
0020: 7E 03 52 14 ..R.
*** Finished, v3.1
verify_data: { 113, 171, 64, 204, 108, 51, 146, 5, 233, 105, 75, 143 }
%% Cached client session: [Session-1, SSL_RSA_WITH_RC4_128_SHA]
[read] MD5 and SHA1 hashes: len = 16
0000: 14 00 00 0C 71 AB 40 CC 6C 33 92 05 E9 69 4B 8F [email protected].
Negotiated Cipher Suite: SSL_RSA_WITH_RC4_128_SHA
When i send the GET
Plaintext before ENCRYPTION: len = 247
0000: 47 45 54 20 2F 70 76 74 6E 3F 41 30 33 30 3D 4D GET /pvtn?A030=M
main, WRITE: SSL v3.1 Application Data, length = 247
main, READ: SSL v3.1 Handshake, length = 24
Plaintext after DECRYPTION: len = 24
*** HelloRequest (empty)
%% Client cached [Session-1, SSL_RSA_WITH_RC4_128_SHA]
%% Try resuming [Session-1, SSL_RSA_WITH_RC4_128_SHA] from port 3535
*** ClientHello, v3.1
RandomCookie: GMT: 1131988975 bytes = { 45, 113, 241, 212, 81, 255, 244, 169, 74, 41, 160, 227, 197, 210, 155, 211, 47, 237, 18, 179, 238, 47, 28, 86, 30, 253, 157, 253 }
Session ID: {208, 18, 243, 174, 216, 156, 80, 201, 121, 136, 63, 162, 31, 196, 186, 95, 193, 143, 238, 172, 173, 79, 64, 219, 17, 149, 14, 138, 53, 95, 18, 96}
Cipher Suites: { 0, 5, 0, 4, 0, 9, 0, 10, 0, 18, 0, 19, 0, 3, 0, 17, 0, 2, 0, 1, 0, 24, 0, 26, 0, 27, 0, 23, 0, 25 }
Compression Methods: { 0 }
[write] MD5 and SHA1 hashes: len = 105
Plaintext before ENCRYPTION: len = 125
main, WRITE: SSL v3.1 Handshake, length = 125
main, READ: SSL v3.1 Handshake, length = 94
Plaintext after DECRYPTION: len = 94
*** ServerHello, v3.1
RandomCookie: GMT: 1131991620 bytes = { 205, 194, 212, 113, 37, 213, 41, 13, 60, 142, 135, 68, 17, 78, 227, 251, 176, 211, 133, 203, 153, 173, 153, 195, 93, 7, 87, 123 }
Session ID: {108, 85, 45, 208, 104, 124, 209, 24, 247, 113, 156, 134, 28, 154, 75, 198, 64, 181, 167, 9, 149, 223, 162, 21, 225, 32, 168, 31, 190, 48, 241, 195}
Cipher Suite: { 0, 5 }
Compression Method: 0
%% Created: [Session-2, SSL_RSA_WITH_RC4_128_SHA]
** SSL_RSA_WITH_RC4_128_SHA
[read] MD5 and SHA1 hashes: len = 74
main, READ: SSL v3.1 Handshake, length = 3154
Plaintext after DECRYPTION: len = 3154
*** Certificate chain
stop on trusted cert: [
Version: V1
Subject: CN=GTE CyberTrust Global Root, OU="GTE CyberTrust Solutions, Inc.", O=GTE Corporation, C=US
Algorithm: [MD5withRSA]
Signature:
[read] MD5 and SHA1 hashes: len = 3134
main, READ: SSL v3.1 Handshake, length = 479
Plaintext after DECRYPTION: len = 479
*** CertificateRequest
Cert Types: RSA, DSS,
Cert Authorities:
[read] MD5 and SHA1 hashes: len = 455
*** ServerHelloDone
[read] MD5 and SHA1 hashes: len = 4
0000: 0E 00 00 00 ....
*** Certificate chain
*** ClientKeyExchange, RSA PreMasterSecret, v3.1
Random Secret: { 3, 1, 19, 223, 230, 65, 59, 210, 10, 69, 239, 178, 185, 5, 52, 57, 44, 160, 163, 239, 85, 64, 173, 16, 132, 234, 33, 228, 0, 8, 134, 52, 20, 190, 196, 15, 205, 35, 169, 39, 14, 160, 143, 74, 210, 74, 43, 181 }
[write] MD5 and SHA1 hashes: len = 141
Plaintext before ENCRYPTION: len = 161
main, WRITE: SSL v3.1 Handshake, length = 161
SESSION KEYGEN:
PreMaster Secret:
.CONNECTION KEYGEN:
Client Nonce:
Server Nonce:
Master Secret:
Client MAC write Secret:
Server MAC write Secret:
Client write key:
Server write key:
0000: FE 94 DF 4C 1A 9F FA CE 0C E9 A6 DB 31 53 E5 FD ...L........1S..
... no IV for cipher
Plaintext before ENCRYPTION: len = 21
0000: 01 0D 16 E6 49 18 36 AF E1 52 9C 2F 72 EE CA DF ....I.6..R./r...
0010: 41 71 68 30 06 Aqh0.
main, WRITE: SSL v3.1 Change Cipher Spec, length = 21
*** Finished, v3.1
verify_data: { 243, 49, 247, 150, 113, 86, 182, 125, 244, 163, 245, 243 }
[write] MD5 and SHA1 hashes: len = 16
0000: 14 00 00 0C F3 31 F7 96 71 56 B6 7D F4 A3 F5 F3 .....1..qV......
Plaintext before ENCRYPTION: len = 36
0000: 14 00 00 0C F3 31 F7 96 71 56 B6 7D F4 A3 F5 F3 .....1..qV......
0010: 1A 7C 8F D9 51 CB 6F 47 2A 7C 90 81 20 EE 97 64 ....Q.oG*... ..d
0020: FF 47 35 CA .G5.
main, WRITE: SSL v3.1 Handshake, length = 36
main, SEND SSL v3.1 ALERT: warning, description = close_notify
Plaintext before ENCRYPTION: len = 22
0000: 01 00 F0 F4 AC 3C B2 DE 95 98 0E B4 ED B1 24 3B .....<........$;
0010: 54 6C 8B DC F3 1F Tl....
main, WRITE: SSL v3.1 Alert, length = 22
java.net.SocketException: Connection aborted by peer: socket write error
void java.net.SocketOutputStream.socketWrite(java.io.FileDescriptor, byte[], int, int)
native code
void java.net.SocketOutputStream.write(byte[], int, int)
SocketOutputStream.java:96
void com.sun.net.ssl.internal.ssl.OutputRecord.a(java.io.OutputStream)
void com.sun.net.ssl.internal.ssl.SSLSocketImpl.a(com.sun.net.ssl.internal.ssl.OutputRecord)
void com.sun.net.ssl.internal.ssl.HandshakeOutStream.flush()
void com.sun.net.ssl.internal.ssl.Handshaker.sendChangeCipherSpec(com.sun.net.ssl.internal.ssl.HandshakeMessage$Finished)
void com.sun.net.ssl.internal.ssl.ClientHandshaker.c()
void com.sun.net.ssl.internal.ssl.ClientHandshaker.a(com.sun.net.ssl.internal.ssl.SunJSSE_o)
void com.sun.net.ssl.internal.ssl.ClientHandshaker.processMessage(byte, int)
void com.sun.net.ssl.internal.ssl.Handshaker.process_record(com.sun.net.ssl.internal.ssl.InputRecord)
void com.sun.net.ssl.internal.ssl.SSLSocketImpl.a(com.sun.net.ssl.internal.ssl.InputRecord, boolean)
void com.sun.net.ssl.internal.ssl.SSLSocketImpl.a(com.sun.net.ssl.internal.ssl.InputRecord)
int com.sun.net.ssl.internal.ssl.AppInputStream.read(byte[], int, int)
int java.io.InputStream.read(byte[])
InputStream.java:91
int java.io.InputStreamReader.fill(char[], int, int)
InputStreamReader.java:173
int java.io.InputStreamReader.read(char[], int, int)
InputStreamReader.java:249
void java.io.BufferedReader.fill()
BufferedReader.java:139
java.lang.String java.io.BufferedReader.readLine(boolean)
BufferedReader.java:299
java.lang.String java.io.BufferedReader.readLine()
BufferedReader.java:362
void Teste3.main(java.lang.String[])
Teste3.java:109
Exception in thread main
Debugger disconnected from local process.
Process exited with exit code 1.
One more thing if if make the same thing via browser (https://mymachine.mydomain.pt/pvtn?someparameter=somevalue) and works fine too (obviously i pre installed the client certificate in the browser and choose the certificate when the pop up show up)
It seems like the handshaking fails when i send data to /pvtn...
Regards,
Paulo.I amhaving the another problem very similar, I am struggling with client authentication with IIS 5.0, and receiving the 'Remote Host closed the connection' error.
Is there any help me in this. I truly apprecaite it
Thanks -
NIO - Selector problem - when using more than one in same application
Hi,
I'm developing a multiplayer-server, which shall be able to handle at least 2000 concurrent clients. To avoid the use of 4000 threads for 2000 clients (a thread for each stream), I would like to use NIO.
Problem:
The server has of course a ServerSocketChannel registered with a Selector, and when clients connects, the SocketChannel's is received. IF these channels is registered (OP_READ) with the same Selector-instance as the ServerSocketChannel, there is no problem and the Selector recognizes when a registered SocketChannel is ready for OP_READ - BUT when the received SocketChannels is registered with another Selector-instance than the one the ServerSocketChannel is registered with, the Selector NEVER recognizes, when a SocketChannel is ready for OP_READ - why not and how do I solve the problem? Only one thread can service the same Selector-instance, and when both receiving many connections and read/write, this could easily be a bottleneck
Following is the used code; 2 classes: ClientListener (has a ServerSocketChannel registered with a Selector) and ClientHandler (has another Selector where the SocketChannels is registered and a thread-pool that services all the SocketChannels, when they are ready for read/write):
public class ClientListener {
private static final int BACKLOG = 32;
private int port;
private Thread internalThread;
private volatile boolean noStopRequested;
private ServerSocketChannel ssc;
private static Selector selector;
private ClientHandler clientHandler;
public ClientListener(ClientHandler clientHandler, String bindAddress, int port) throws InternalErrorException {
this.clientClass = clientClass;
this.clientHandler = clientHandler;
this.noStopRequested = true;
this.port = port;
try {
InetAddress inetAddress;
if (bindAddress.equals(""))
inetAddress = InetAddress.getLocalHost();
else
inetAddress = InetAddress.getByName(bindAddress);
ssc = ServerSocketChannel.open();
ssc.socket().bind(new InetSocketAddress(inetAddress, port), BACKLOG);
ssc.configureBlocking(false);
Runnable r = new Runnable() {
public void run() {
try {
start();
} catch (Exception e) {
Log.echoError("ClientListener: Unexpected error: "+e.getMessage());
internalThread = new Thread(r, "ClientHandler");
internalThread.start();
} catch (Exception e) {
throw new InternalErrorException(e.getMessage());
public static Selector selector() {
return selector;
private void start() {
Log.echoSystem("ClientListener: Listening started at port "+port);
try {
selector = Selector.open();
SelectionKey acceptKey = ssc.register(selector, SelectionKey.OP_ACCEPT);
int keysAdded;
while (noStopRequested) {
SelectionKey key = null;
keysAdded = selector.select(10000);
if (keysAdded == 0)
continue;
Set readyKeys = selector.selectedKeys();
Iterator i = readyKeys.iterator();
while (i.hasNext()) {
try {
key = (SelectionKey)i.next();
i.remove();
if (key.isAcceptable()) {
ServerSocketChannel nextReady = (ServerSocketChannel)key.channel();
SocketChannel sc = nextReady.accept();
try {
clientHandler.registerClient(sc);
} catch (Exception e) { e.printStackTrace(); }
} catch (CancelledKeyException cke) {
System.out.println("ClientListener: CancelledKeyException");
} catch (Exception e) {
e.printStackTrace();
try {
ssc.close();
} catch (IOException ioe) {/* Ignore */}
Log.echoSystem("ClientListener: stopped");
public void stop() {
public class ClientHandler {
private static final int INITIAL_WORKER_COUNT = 5;
private int port;
private Thread internalThread;
private volatile boolean noStopRequested;
private static Selector selector;
private Manager manager;
private WorkerPool pool;
private ClientListener clientListener;
public ClientHandler(Manager manager, String bindAddress, int port) throws InternalErrorException {
this.manager = manager;
this.noStopRequested = true;
this.port = port;
clientListener = new ClientListener(this, bindAddress, port);
// initiating load-balanced worker-pool
pool = new WorkerPool(INITIAL_WORKER_COUNT, (int)(manager.getMaxClients() * ClientWorker.CLIENT_FACTOR), 0.75f);
for (int i=0; i < pool.getMinCount(); i++) {
pool.addWorker(new ClientWorker(pool, manager));
Runnable r = new Runnable() {
public void run() {
try {
start();
} catch (Exception e) {
Log.echoError("ClientHandler: Unexpected error: "+e.getMessage());
internalThread = new Thread(r, "ClientHandler");
internalThread.start();
public static Selector selector() {
return selector;
private void start() {
Log.echoSystem("ClientHandler: Started");
try {
selector = Selector.open();
int keysAdded;
while (noStopRequested) {
SelectionKey key = null;
try {
keysAdded = selector.select();
Log.echoDebug("ClientHandler: out of select()");
if (keysAdded == 0)
continue;
Set readyKeys = selector.selectedKeys();
Iterator i = readyKeys.iterator();
while (i.hasNext()) {
try {
key = (SelectionKey)i.next();
i.remove();
if (key.isReadable()) {
key.interestOps(key.interestOps() & (~SelectionKey.OP_READ));
ClientWorker worker = (ClientWorker)pool.getWorker();
worker.process(key);
} else if (key.isWritable()) {
key.interestOps(key.interestOps() & (~SelectionKey.OP_WRITE));
ClientWorker worker = (ClientWorker)pool.getWorker();
worker.process(key);
} else {
} catch (CancelledKeyException cke) {
Client client = (Client)key.attachment();
if (client != null) {
client.disconnect();
key.selector().wakeup();
} catch (CancelledKeyException cke) {
if (key != null) {
Client client = (Client)key.attachment();
if (client != null) {
client.disconnect();
key.selector().wakeup();
} catch (Exception e) {
e.printStackTrace();
Log.echoSystem("ClientHandler: stopped");
public void registerClient(SocketChannel sc) throws Exception {
sc.configureBlocking(false);
Client client = new Client(...);
SelectionKey key = sc.register(selector, SelectionKey.OP_READ, client);
key.selector().wakeup();
public void stop() {
}Ok, found the solution here: http://forum.java.sun.com/thread.jsp?forum=31&thread=282069
"The select() method holds a lock on the selector that
the register() method wants to acquire. The register()
method cannot continue until the lock is relased and
the select() method will not release it until some key
is triggered. If this is the first key you're adding
then select has nothing that will wake it up, ever.
The result is, obviously, a deadlock.
The solution is to have a queue of pending connections.
You put your new connection in that queue. Then you
wake up the selector and let that thread go through
the queue, registering connections." -
Date Sent not showing in Sent Mail
After a certain date, using Mail application, the Date (sent) is not showing in the header along with To & From & Subject. Why?
I have tried to get it to show using view prefs. Doesn't work.
I have changed to using a network time server. Doesn't work.
I've tried moving it to another folder. Doesn't work.
I need the date to show so when I print, I have proof of date and time sent...
Anyone?Not sure about the time stamp problem, but the missing "Sent" mails problem is not uncommon. This problem is one that a lot of people have and in my opinion, I think it's a problem with Apple's mail application, nothing at the user's end.
Does this happen only when you include an attachment or does that matter? Also, does it only happen when your outgoing message is delayed a bit? Check your junk/spam folder to see if your sent messages went in there.
This doesn't fix anything, but you might change your e-mail settings so that all new mails are automatically sent Bcc to yourself.
Sometimes the "missing" sent mails are not going in the right folder. I'm sure you probably already know, but in the left-hand column in MAIL, under Mailboxes, there is a second "sent" folder way at the bottom, depending on your other e-mail accounts, such as Yahoo or Gmail). Many people have discovered their missing "sent" e-mails in those.
It is a big hassle, for sure, and has been officially reported. Users with complaints are being told that Apple's Intrusion Detection and Prevention (IDP) systems block the connection from a user's e-mail client when it attempts to store outgoing e-mails, which contain attachments, to the users' sent folder.
This is supposedly due to the Mac OS/Mac Mail sending non-standard or erroneous commands to the server, emulating the activity which would be generated by an attacker attempting to abuse an exploit in the IMAP server. I doubt you are doing anything wrong, so it's just a matter of waiting for them to FIX this annoying issue. -
Association rule in SQL Server Data Mining
I have been working on a problem on association rules in SQL Server Data Tools (Visual Studio 2008) for quite a while but have not yet been able to figure out the solution.
The problem is: I have a table named Sales_history in my SQL database. This table has following columns: CustomerID, ItemID, Month (from May2012 to April 2013), QtyShipped. I am looking to find association between Items and i want to provide recommendation
to the Customer (In this case CustomerID) based on their purchases.
Note: there are around 630 customers and about 34000 products in my table.
My approach:
I marked History_Table as both Key and nested. And in the Key, i checked CustomerID as input and Key whereas in nested, i checked ItemId as Key, input and Predict.
When i run the model, i get a solution but i am not sure if i am configuring it right. Also i am not sure how i can write prediction join query to generate Item recommendations . I am really struggling with
this problem, eagerly waiting for the reply. Thank you.Hi Tatyana,
Thank you so much for your reply. I have now been able to create the data mining model using association rule and by writing a DMX query, i am able to generate the item recommendations to be given to customers for items they have purchased. However, i have
noticed one thing that in the DMX query, it gives the same item recommendation for any item i put inside the query.
Also, if i put any item in the DMX query from the generated list of recommended items, the output of that query also shows the item that is inputted inside the query.
Here is the query, that i am writing to generate item recommendations
SELECT predictassociation (CrossSellingModelV3.[Ztb Customer Item v3],INCLUDE_STATISTICS,5)
FROM CrossSellingModelV3
NATURAL PREDICTION JOIN
(SELECT
(SELECT '17IS56126' as m )
AS Ms)
AS t
What can be the possible reason behind this? Is this something related to the kind of data i have? In my data, there are 632 distinct customers and 34000 distinct products.
If i execute this query in management studio.
select customer_CD, COUNT(Item_CD) from ztb_Sales_History
group by customer_CD
order by 2 desc
the output shows that there are some customers who have bought just 1 item and also there are customers who have bought 2400 items. i mean the range is very high. -
NIO Non-Blocking Server not Reading from Key
I have created a NIO non blocking server (below) and it will not pick up any input from the client.... My log doesnt even show that it enters the readKey() method, so it must be something before. Any help would be appreciated.
Scott
package jamb.server;
import java.io.IOException;
import java.net.InetAddress;
import java.net.InetSocketAddress;
import java.nio.ByteBuffer;
import java.nio.CharBuffer;
import java.nio.channels.ClosedChannelException;
import java.nio.channels.SelectionKey;
import java.nio.channels.Selector;
import java.nio.channels.ServerSocketChannel;
import java.nio.channels.SocketChannel;
import java.nio.channels.spi.SelectorProvider;
import java.nio.charset.Charset;
import java.nio.charset.CharsetDecoder;
import java.util.Iterator;
import java.util.Set;
import java.util.logging.Logger;
import java.util.prefs.Preferences;
import jamb.server.client.Client;
public class Server {
private Selector selector;
private ServerSocketChannel serverChannel;
private static Logger logger = Logger.getLogger("jamb.server");
private static Preferences prefs = Preferences.systemRoot().node("/jamb/server");
public void init() {
logger.entering("jamb.server.Server", "init");
//Get a selector...
try {
selector = SelectorProvider.provider().openSelector();
//Open the SocketChannel and make it non-blocking...
serverChannel = ServerSocketChannel.open();
serverChannel.configureBlocking(false);
//Bind the server to the port....
int port = prefs.getInt("Port", 4000);
logger.config("Server configured on port " + port + " (default: 4000)");
InetSocketAddress isa = new InetSocketAddress(
InetAddress.getLocalHost(), port);
serverChannel.socket().bind(isa);
} catch (IOException ioe) {
logger.severe ("IOException during server initialization!");
logger.exiting("jamb.server.Server", "init");
public void run() {
logger.entering("jamb.server.Server", "run");
int bufferSize = prefs.getInt("BufferSize", 8);
logger.config("Buffer size set to " + bufferSize + " (default: 8)");
SelectionKey acceptKey = null;
try {
acceptKey = serverChannel.register(
selector, SelectionKey.OP_ACCEPT);
} catch (ClosedChannelException cce) {
try {
while (acceptKey.selector().select() > 0) {
Set readyKeys = selector.selectedKeys();
Iterator i = readyKeys.iterator();
while (i.hasNext()) {
//logger.finest("Processing keys...");
//Get the key from the set and remove it
SelectionKey currentKey = (SelectionKey) i.next();
i.remove();
if (currentKey.isAcceptable()) {
logger.finest("Accepting key...");
acceptKey(currentKey);
} else if (currentKey.isReadable()) {
logger.finest("Reading key...");
readKey(currentKey, bufferSize);
} else if (currentKey.isWritable()) {
//logger.finest("Writing key...");
writeKey(currentKey);
} catch (IOException ioe) {
logger.warning("IOException during key handling!");
logger.exiting("jamb.server.Server", "run");
public void flushClient (Client client) {
try {
ByteBuffer buf = ByteBuffer.wrap( client.getOutputBuffer().toString().getBytes());
client.getChannel().write(buf);
} catch (IOException ioe) {
System.out.println ("Error writing to player");
client.setOutputBuffer(new StringBuffer());
private void acceptKey (SelectionKey acceptKey) {
logger.entering("jamb.server.Server", "acceptKey");
//Retrieve a SocketChannel for the new client, and register a new selector with
//read/write interests, and then register
try {
SocketChannel channel = ((ServerSocketChannel) acceptKey.channel()).accept();
channel.configureBlocking(false);
SelectionKey readKey = channel.register(
selector, SelectionKey.OP_READ|SelectionKey.OP_WRITE );
readKey.attach(new Client(this, channel));
} catch (IOException ioe) {
System.out.println ("Error accepting key");
logger.exiting("jamb.server.Server", "acceptKey");
private void readKey (SelectionKey readKey, int bufSize) {
logger.entering("jamb.server.Server", "readKey");
Client client = (Client) readKey.attachment();
try {
ByteBuffer byteBuffer = ByteBuffer.allocate(bufSize);
int nbytes = client.getChannel().read( byteBuffer );
byteBuffer.flip();
Charset charset = Charset.forName( "us-ascii" );
CharsetDecoder decoder = charset.newDecoder();
CharBuffer charBuffer = decoder.decode(byteBuffer);
String text = charBuffer.toString();
client.getInputBuffer().append(text);
if ( text.indexOf( "\n" ) >= 0 )
client.input();
} catch (IOException ioe) {
logger.warning("Unexpected quit...");
client.disconnect();
logger.exiting("jamb.server.Server", "readKey");
private void writeKey (SelectionKey writeKey) {
//logger.entering("jamb.server.Server", "writeKey");
Client client = (Client) writeKey.attachment();
if (!client.isConnected()) {
client.connect();
//logger.exiting("jamb.server.Server", "writeKey");From my own expierence with the NIO (Under Windows XP/ jdk1.4.1_01); you can't seem to set READ and WRITE at the same time.
The program flow I usually end up with for a echo server is:
When the selector.isAcceptable(): accept a connection; register for READs
In the read event; write the incoming characters to a buffer; register for a WRITE and add the buffer as an attachment.
In the write event; write the data to the socket If all the data was written; register for a READ; otherwise register for another WRITE so that you can write the rest.
Not sure if that the "proper" way; but it works well for me.
- Chris
Maybe you are looking for
-
BI 7 - BEX Query Designer variable question
Hi all, If I have an Entry Variable in the selection screen of a query, is it possible to populate another variable based on the user input. e.g. If I have a Report Date with a mandatory input, and I want a CalMonth variable to be populated based on
-
Issues using Oracle SQL server Developer migration work bench
Hi all, We are trying to migrate the application databases from SQL server 2000 to Oracle 10g using Oracle SQL Developer 1.2.1.32.13: Following is the list of issues that we faced while trying out this migration on dev environment. 1. The data migrat
-
Possibility to pause drawing of a scene or group of nodes temporarily
Is there any way to temporarily pause the javafx runtime drawing operations? The issue I'm having is that I have a sort of physics simulation running with tens of different physical objects. The objects have their x and y co-ordinates bound to circle
-
"impossible recover" unknown error 3200 !!!!!!!
Apple please do something quickly ! iPhone 4 - trying update to ios5 (three time trial) always "impossible recover" unknown error 3200 !!!!!!!
-
Office 365 Calendar invites truncated meeting notes
We have noticed that whenever a user accepts a meeting invite on their iOS device that the notes get truncated - so the user loses any dial in details or message details contained with the diary invite, which is a major issue for any business user.