How can I detect arrival of data on socket?
I have written a bean which uses a (client) socket to send data to a socket server program. This works fine.
My problem is that I also want the bean to be able to detect the arrival of data on its socket without going into a read loop.
From what I have read, I think I need to set up some sort of a listener to trap this. Unfortunately, I have been unable to find a code example that I can figure out or looks useable.
Please bear in mind that my server program is written in another language.
Any suggestions?
Thanks in advance!
Well in Java you do something like this:
-create the serverSocket:
ServerSocket serverSocket = new ServerSocket(PORTNR);
- usually you put this line in a while(listening) loop:
Socket clientSocket = serverSocket.accept();
Once someone tries to connect to the socket the accept() method returns a Socket to the client. Usually you create a thread to take care of the client and then reloop and go back waiting at the accept() metod.
If you want help to do this in a different language, I guess you should specify which language, or perhaps find a forum for that language to ask.... (or do both)
Sjur
Similar Messages
-
How can I detect a certain text within a field within CASE using IF
Dear all,
for a transformation / generation of values receiving from R/3 into BW I try to
manupulate three fields. I have a problem detecting a string in a field.
I am using a CASE with several WHEN clauses on one field. Depending on the
value, an IF is integrated. There I look into another field evaluating, if it contains
a certain string. E.g. IF STRING CP 'xyz' OR 'abc'.
System gives error for the locigal expression. I also tried CS, but same error.
How can I detect a certain text within a field and which is the right logical
expression.
Many thanks in advance!!!
ClaudiaHi,
Folow the blow example...
May be it helps....
DATA: hex1 TYPE string,
hex2 TYPE string.
hex1 = 'FFFF'.
hex2 = '123FF'.
IF hex1 CP hex2.
ENDIF.
Cheers,
SImha. -
How can I transfer all my data including SMS to my mac/windows computer?
My friend has asked me to help her transfer all the data from her iPhone 3GS to a computer then to a hard drive. She has several folders with pictures in but image capture on mac is only picking up the one. I have an iPhone 4S and iPad 3 installed already on iTunes so don't want to accidentally erase her phone.
She also needs some of the SMS messages taking off of her phone and saving either as they are or in some form of text file so they are readable in the future.
How can I retrieve all this data including the messages without losing anything and can it be done for free?
If you need anymore info please just ask and I'll try and pass it on to the best of my (limited) knowledge.
Thanks in advance!http://www.iphonebackupextractor.com/
SHe can also do a backup of her phone and it will save the text message, but she won't be able to view the text unless she restores to the backup. -
How can I sort lines of data (alphabetically) in the new pages 5.0?
How can I sort lines of data (alphabetically) in the new pages 5.0?
It was very simple to do in the previou version of pages.I'm not sure why people are torturing themselves with Pages 5 given the nearly universal outcry on this forum and the incredibly negative reviews elswhere, such as the App Store.
Pages 4.3 should still be in an iWorks folder within your Applications folder. Just use that.
Please remember to tell Apple what we need from them at:
http://www.apple.com/feedback/pages.html -
How can i get the meta data from database?
Hi, all java and db experts,
I need to write a tool to generate java file which will be used to hold the resultset of a stored procedure of Oracle. Is there any API call or tools to connect to db and then get the meta data of the return cursor instead of reading stored procedure definition on my own?
Please help, thanks a lot.
Hannaif i execute a Oracle stored procedure, the resultset of a cursor is returned. It's easy to know the meta data at the runtime.
However, could i get the meta data about the resultset of a cursor before runtime? Such as by connecting to the database and ask it about meta data of a specified stored procedure?
Is it feasible?
DatabaseMetaData dbmd = conn.getMetaData();
ResultSet rs = dbmd.getProcedureColumns("", "%", "SP_NAME", "%");
while (rs.next()) {
String colName = rs.getString(4);
int colType = rs.getInt(5);
int colDataType = rs.getInt(6);
int colPrecision = rs.getInt(8);
int colLen = rs.getInt(9);
int colScale = rs.getInt(10);
long defaultValue = rs.getLong(11);
But what i get is a list of stored procedure parameters. In oracle, cursor is IN OUT parameter . How can i get the meta data about the resultset of cursor? -
How can I transfer my stickienotes data from my imac to a new macbook air computer? I can't find it in Library as I should.
You can download CS4 here. Download CS4 products
Most comments I've seen say CS4 needs to be run in compatibility mode on Win 8.1. Windows 8.1 compatibility for Adobe Photoshop CS4 version 11
But the only way to know for sure is to try it. -
How can I restore the game data from an old ipod touch to a new one?
How can I restore the game data from an old ipod touch to a new one?
Restore it from the backup of the old ipod.
-
I have forgotten my password for icloud, have an invalid email address and do not know my security answers. How can I transfer all my data from my old iphone to the new one?
In this case you won't be able to do that?
-
How can i transfer all my data 250 GB from external hard disk to MAC pro
How can i transfer all my data 250 GB from external hard disk to MAC pro
The simple answer is just connect the external hard drive and drag the files from there to wherever you want them to go. If you need to do something more specific, you'll have to provide more details.
-
Hi...i bought the new iphone 4 and would like to ask how can i transfer all my data from my old iphone to the new one? If I will do "synchronization" through itunes with the old phone and the plug in the new one will that be the case?
Follow the instructions in this article to transfer your info: iPhone: Transferring information from your current iPhone to a new iPhone
-
How can I find out the date of a movie I am trying to pre-order if the date is not available/showing in the "manage pre-order" section?
Thanks so much for your reply King_Penguin. No, sadly there is not indication of the expected release date on the film, it's no where to be found. I have also tried to look in other places online, but no luck. I guess your latter statement jives more with my situation, that being the studio/rights-holder hasn't feel inclined to provide the date.
-
I have made a burn folder with photos exported from I-photo. It now shows in information, that the date created and modified is different from the original digitized date. How can I get the original date to show in the info from Finder?
The Finder reports File information. The date and time of the photo are in the Photo's Exif metadata. The Finder has no awareness of this. All photos apps on any system do.
Regards
TD -
How can I detect a dialog and respond?
I'm having trouble doing something that's probably not that hard. I'm trying to "Print to PDF" a bunch of old AppleWorks documents. When you open a document created in AppleWorks v6 it opens right up, but when you open a document created in AppleWorks 5 you get a dialog box that says, "This document was created by a previous version of AppleWorks. A copy will be opened and "[v6.0]" will be added to the filename."
Right now I open the file and then:
tell application "AppleWorks 6"
activate
repeat while not (exists front document)
delay .2
end repeat
end tell
When the dialog box pops up, there's no front document so the whole thing freezes until you hit OK. How can I detect this dialog box and dismiss it?
Thanks
PS
When the box is open I ran this and got this result:
/usr/bin/osascript -e 'tell application "System Events" to get properties of windows of application process "AppleWorks 6"'
minimum value:missing value, orientation:missing value, position:436, 153, class:window, role description:dialog, accessibility description:missing value, focused:missing value, title:missing value, size:412, 123, value:missing value, help:missing value, enabled:missing value, maximum value:missing value, role:AXWindow, entire contents:, subrole:AXDialog, selected:missing value, name:missing value, description:dialog, minimum value:missing value, orientation:missing value, position:8, 76, class:window, role description:floating window, accessibility description:missing value, focused:missing value, title:Starting Points, size:631, 189, value:missing value, help:missing value, enabled:missing value, maximum value:missing value, role:AXWindow, entire contents:, subrole:AXFloatingWindow, selected:missing value, name:Starting Points, description:floating window, minimum value:missing value, orientation:missing value, position:4, 22, class:window, role description:floating window, accessibility description:missing value, focused:missing value, title:Button Bar, size:612, 51, value:missing value, help:missing value, enabled:missing value, maximum value:missing value, role:AXWindow, entire contents:, subrole:AXFloatingWindow, selected:missing value, name:Button Bar, description:floating windowHi,
The simplest would be to set the application preferences in the script.
Like this :
-- *** set prefs ****
tell application "AppleWorks 6"
activate
set oldPrefs to its preferences
copy oldPrefs to tPrefs
tell tPrefs
set old version warning to false --doesn't show the old version warning alert
set converted file suffix to true -- append “[v6.0]” to documents converted from older formats
set locked file warning to false
set paint reduction warning to false
end tell
set preferences to tPrefs
end tell
-- *** end set prefs ****
--**** your script, example ***
set tfiles to choose file with multiple selections allowed
tell application "AppleWorks 6"
repeat with i in tfiles
open i
tell front document
-- do something
end tell
end repeat
end tell
--**** end your script ***
-- *** reset prefs ****
tell application "AppleWorks 6" to set preferences to oldPrefs -
Hello Everyone,
We all know whenever we try to connect to a PC which is not on network, we get UnKnownHostException etc..... by which we can detect that the corresponding PC is not an network(intranet/internet)
But when i send a msg from my PC to my PC, it works fine even if the network is down. I hv provided my PC's IP address instead of using localhost or 127.0.0.1 which reduces the possibility that the msg will not be traversed thru the network.
Any IDEA how this works.
Is There any possible way by which i can detect that my PC is not on network or the PC to which i'm trying to connect is not on network .......
Pls help me out, its really urgent as to be implemented in my Project
Thanks In Advance
Sahil ShaikhHello Surtee
I have developed a Messeging Service for the eCRM Apllication my company is developing and we r in the final stage of debugging.
Now whenever a user sends a msg to a PC which is not on network, the messaging service automatically sends an Offline mssg to that PC. But know i want ot distinguish wheather the PC to which i'm sending the msg is not on network or am I not on network based on this i need to perform diff. actions, hence i wanted to know that how can i detect .......
Pls see if u canhelp me out ......
Thanks
Sahil Shaikh -
Hi,
Can anybody help me out on the follwoing questions
how can i view my iphone contents on PC. How can i view my backup data in itunes. How can i see my SMS and contact on PCThe data isn't actually stored in iTunes. iTunes is like a card catalog that allows you to access information from the various places that it's stored on the computer. SMS and contact info will be viewable in whatever program you sync contact information. The backup actually keeps the files, but doesn't make them viewable, I'm pretty sure. You can only see the info you've actually synced.
Maybe you are looking for
-
Creation of a new Authorization object
Hi , I need to create a new Authorization group and add three existing tables to it. Kindly suggest a way. Regards.
-
Line objects not showing in pdf output in xmlp 5.6.1
Hello, Is there a bug or just a version issue when trying to produce pdf output using xmlp 5.6.1 Enterprise Edition from a template built in xmlp 5.6.2 stand alone? Different versions of pdf too. The xmlp 5.6.1 EE uses Adobe 7.0.7 and I use 7.0.0 for
-
Whey I Plug in my ipod i tunes did not pop up need help please
Please help
-
When will the 5th generation iPod Touch be available
When will iPod touch 5g be shipping or availalbe in stores?
-
I have bought one asset on 2006. It is getting depreciated every year. After 3 years I find that my asset value is higher than it should actually be. I want to change the asset value. Can I make the changes, if yes, How?