Problem sending more than one meaasage to server
iam writing a program where a cleint connect to a server and sends an Message Object across (where my message object is a class with many attributes) so i break it down into a byte array and send it to the server... this is fine the server accepts it and display the masseage fine but
when i try to send another message it doesnt recieve it, and the problem is not with the server as it will accept messages if i connect another client to it
here is my code for sending the message.. any suggestions??????????????
public void sendMessageToServer(Message message) throws java.io.IOException
byte[] data;
data = message.messageToBytes(message);
out.write(data,0,data.length);
out.flush();
messageToBytes(message); simply break the message down into a byte array and returns it
its fine i got it, i was waiting for a new client to connect before i wud accpet there message hance it working for different clients and not for the one already connected.... anyway back to work
Similar Messages
-
Sending more than one string from a server to a client in TCP/IP
hi,
i have two VIs where one is the server and the other the client in TCP/IP. I need to send more than 2 strings to the client at the same time.i have used the XML method but then by using XML i cant send any thing else to the client because of the byte sizes. so either i need a new way to send the strings or a new way to send more data. i have attached my VIs to this post if you need to take a look.
thanks,
Rambaldi.
Attachments:
ServerClient.zip 83 KBWell, after looking at the code it is very difficult to understand what you are trying to do. Not to be nasty or anything but your code is a mess. Did you know that in both VIs you have an infinite loop? The only way to exit your VIs is to use the Abort button. This is bad since it doesn't allow you to actually perform any type of cleanup. Your wiring is very difficult to follow. You should also avoid using local variables to pass data through your application. If you need to pass data between two parallel processes use queues, notifiers or an action engine. You can get rid of all of the sequence frames that you have. They aren't really doing anything for you and are unnecessary.
As to your particular question I would have to assume that it is simply a result of bad coding that is preventing you from sending more than one string. You have logic in the second loop that appears to be impossible to get to since the conrol used to switch the case statement is placed on a hidden part of the front panel. Take a look at the TCP server example I posted in this thread. The example is on the second page of that thread.
In order to help you I think you need to provide a good description of exactly what you want your server and client to do. You also need to do some code cleanup to make it readable and easier to follow.
Mark Yedinak
"Does anyone know where the love of God goes when the waves turn the minutes to hours?"
Wreck of the Edmund Fitzgerald - Gordon Lightfoot -
Sending more than one data to Socket
Hi Guys
How can i send more than one data to socket. What i have to do is
in server side
1) Want to send file data to socket
2) and the name of the file to socket
in client
1) read the file data from socket
2) read the file name from the socket
3) and save the file.
how can i do this, I know how to send only file data, but i am finding dificuilt to send both.
please some one help me with sample code.
Thanks in advance
ShanThanks for the reply
the problem i am facing is send the file name and data together . I have modified a code to send the file data, giving the static file name at the client side. Could you please help me to modify the code to send both file name and data from server. I am pasting my code. Sorry to ask like this but i am struggling a lot in this issue. When you are free please help me.
(Also i don't have any Duke dollers to assign for this post)
import java.io.*;
import java.net.*;
class Server
public static void main(String args[]) throws Exception
try{
String clientSentence;
ServerSocket welcomeSocket = new ServerSocket(80);
while(true)
Socket connectionSocket = welcomeSocket.accept();
BufferedReader inFromClient = new BufferedReader(new InputStreamReader(connectionSocket.getInputStream()));
BufferedOutputStream outToClient = new BufferedOutputStream(connectionSocket.getOutputStream());
System.out.println(inFromClient.readLine());
int data;
int totalSizeTransferred = 0;
int totalSizeRead;
int PACKET_SIZE = 20480;
byte[] packet = new byte[PACKET_SIZE];
System.out.println("reading file...");
FileInputStream fis = new FileInputStream("36meg.pdf");
while ((totalSizeRead = fis.read(packet, 0, packet.length)) >= 0)
outToClient.write(packet, 0, totalSizeRead);
totalSizeTransferred = totalSizeTransferred + totalSizeRead;
System.out.println(totalSizeTransferred);
System.out.println("done reading file...");
outToClient.close();
fis.close();
}catch(Exception ex){}
import java.io.*;
import java.net.*;
class Client
public static void main(String args[]) throws Exception
String sentence;
BufferedReader inFromUser = new BufferedReader(new InputStreamReader(System.in));
Socket clientSocket = new Socket("194.129.252.65", 80);
DataOutputStream outToServer = new DataOutputStream(clientSocket.getOutputStream());
BufferedInputStream inFromServer = new BufferedInputStream(clientSocket.getInputStream());
sentence = inFromUser.readLine();
outToServer.writeBytes(sentence + '\n');
FileOutputStream fos = new FileOutputStream("hello.jpg");
int totalDataRead;
int totalSizeWritten = 0;
int DATA_SIZE = 20480;
byte[] inData = new byte[DATA_SIZE];
System.out.println("Begin");
while ((totalDataRead = inFromServer.read(inData, 0, inData.length)) >= 0)
fos.write(inData, 0, totalDataRead);
totalSizeWritten = totalSizeWritten + totalDataRead;
System.out.println(totalSizeWritten);
System.out.println("Done");
fos.close();
clientSocket.close(); -
How can i send more than one signal to DMA FIFO?
Hello,
I'm trying to send more than one signal to DMA FIFO, but i don't know how to do. When i send one signal i don't have problems. I try to use one block DMA FIFO for one signal. For example if i have 3 signal i use · DMA FIFO but whe i want to wath them in a waveform chart the signals have a delay.
How can I do to send more than one signal to DMA FIFO? and if that's no posible, How i can do for syncronizate the 3 signals?
The data type of the signal is FXP <16,10>
Regards.
Pablo
Solved!
Go to Solution.
Attachments:
Block Diagram.jpg 81 KB
Block Diagram.jpg 81 KBNot quite. You need to use the Integer To Fixed Point Cast to change from the integers to your FXP numbers. You can then build them into a cluster to write to the Waveform Chart.
There are only two ways to tell somebody thanks: Kudos and Marked Solutions
Unofficial Forum Rules and Guidelines
Attachments:
Combine and Decode FXP.png 14 KB -
How can i transfer more than one file from server to client
Hi,
our requirement is transfer more than one files from server to client using the
webutil_file_transfer.as_to_client_with_progress.One file transfer is already working in our system.If anybody know the solution please inform
regards
matjust an idea ...
for this purpose let us put aside security concerns and other potential problems....
-- Get the content of a server directory with Filter and create zip file
1) create a class that implements java.io.FilenameFilter ...
2) define accept() method ...
3) call File.list() with the filter as a parameter. The returned array of strings will have all the names that passed through the accept() filter
4) use java.util.Zip to create ZIP file on the server side
-- I think it is better to create this functionality as a separate Java class, put it in required folder and after it
-- use Forms->Program->"Import Java class" to create pl/sql wrappers, than to create wrappers for all classes and code in pl/sql
5) use webutil to transfer file on the client
6) use Java on client side to unzip transferred file
if you think this is not too complicated, you should try ...
Regards,
Vladimir -
While on vacation in Canada in July I started having trouble sending more than one pix at a time to other users. I don't recall having this problem before. Is there a limit on the number of pictures you can send via text? I wonder if I messed up some settings while I was in Canada. I had things set so that I could not receive phone calls so I wouldn't get charged. Could I have messed up text / multimedia settings as well?
We want your phone working just as well now as it did before your trip, sngbrd9. Are you trying to send the pictures to other Apple users using iMessage or are they being sent through MMS/picture messaging? Are you able to send pictures one at a time to those same contacts without an error? Did you change any settings in your camera to have HDR now instead of a slightly lower resolution with a smaller file size?
JenniferH_VZW
Follow us on Twitter www.twitter.com/vzwsupport -
App that can send more than one attachment at a time....
Does anyone know of a app that I can send more than one attachment at a time like resumes + cover letters. Not having any luck with gmail or pages for the Ipad.
Please helpThe MPEG Streamclip app can batch process videos. It can even convert up to 4 videos at the same time.
http://www.squared5.com/
It's free...
Just drop as many videos as you like into the batch window. -
How can I send more than one document on an email
how can I send more than one document on one email
Thank you but I understand that form of attaching a document. However when I select a document then click 'Share' I have the option of sending the document by email as a word or pages document or pdf, what I want to know is can I use this procedure to send more than one document per email and if I can how?
-
How can I send more than one foto in a email
How can I send more than one foto in a email?
Or, to send up to 5 photos in one email, open the Photos app, go to the Album containing the photos, tap Select, tap up to 5 photos (a blue tick will appear on them), then tap the Share icon (square with arrow pointing up) and choose Mail.
If you choose more than 5 photos this way, you won't get the Mail option. -
Sending more than one photo at a time
OK, fine, no MMS. We have to e-mail our pics to our friends.
But is there any way on an iPhone 3G to send more than one photo attachment at a time? Sometimes I'd like to send two or three pixs to my friends of an event and that means two or three separate e-mails that have to be addressed.
Can't I just tag or mark more tan a single photo and send the bunch?unfortunately, its 1 picture only
-
Ever since I updated my iphone 4 to 5.1.1, I am not able to send more than one picture at a time in a text message. Does anyone know how to fix this?
Yes, I know the photos stored on the device... But which app are you accessing the photos with? Which app do you want to be able to highlight more than one pic at a time in?
There are literally thosands of apps that access the iOS Photo Library - which one(s) are you using? -
I am having problems emailing more than one photo at a time - please help!
I would be very grateful if anyone can help. I have recently upgraded my old PowerBook G4 to Leopard 10.5.8, and since the upgrade I can't seem to send more than one image from iphoto at a time via mail. When I try, I get the message: " mail got an error: can't get paragraph 8 of content of outgoing message id 113491328. Invalid index." As I email a lot of images, it is a real pain only being able to send them one at a time. Can anyone help? With many, many thanks, Josh.
It could have something to do with the sizes of the images you're trying to send.
In the updated iPhoto, there's a selection for the size of the image. Try attaching the smallest size and see if that works for you.
Here's a related couple of threads related to the error that I found on a popular search engine
--> http://discussions.apple.com/thread.jspa?threadID=1666379
--> http://discussions.apple.com/thread.jspa?threadID=1667250 -
CAN ANDROID SEND MORE THAN ONE PICTURE IN A SINGLE TEXT
Hello,
Can anyone tell me if Android Razr M is capable of sending more than one picture in a single email and how to do it? Example: I have several pictures to send to one person and do not want to send them one at a time if I don't have to. Thank youSome devices if you long press on the text screen have the ability to send more than one photo. However your owners manual usually has this information.
You also may not be able to send these multiples due to size constraints. Email is much better for these photos. Which of course is also limited by your ISP to around 10 megabytes per send.
Good Luck -
How to send more than one parameter from FORM to REPORT?
Dear all,
i can send one parameter from FORM to REPORT. but when i send more than one parameter it gives error: frm 41214 unable to run report.
here is the code i think the error is in the following line of procedure:
SET_REPORT_OBJECT_PROPERTY(repid,REPORT_OTHER,'paramform=no p_date_from='||v_date_from||'p_date_to='||v_date_to);
where to place the parameters and is there any space is required?
Thanks
Muhammad NadeemDear Saeed Iqbal,
thanks for you reply.
dear i am using Form 10g run_product is not supported in this version.
i am using RUN_REPORT_OBJECT.
PROCEDURE rep_gl_ledger IS
repid REPORT_OBJECT;
v_rep VARCHAR2(100);
rep_status VARCHAR2(50);
v_date_from date;
v_date_to date;
v_detail_id_from varchar2(100);
v_detail_id_to varchar2(100);
v_voucher_type varchar2(100);
--req_no char(17);
BEGIN
v_date_from := :ledger_para.p_date_from;
v_date_to := :ledger_para.p_date_to;
v_detail_id_from := :ledger_para.p_detail_id_from;
v_detail_id_to := :ledger_para.p_detail_id_to;
v_voucher_type := :ledger_para.p_voucher_type;
repid := find_report_object('gl_ledger');
--repid := find_report_object('REPORT80');
SET_REPORT_OBJECT_PROPERTY(repid,REPORT_EXECUTION_MODE,BATCH);
SET_REPORT_OBJECT_PROPERTY(repid,REPORT_COMM_MODE,SYNCHRONOUS);
SET_REPORT_OBJECT_PROPERTY(repid,REPORT_DESTYPE,CACHE);
SET_REPORT_OBJECT_PROPERTY(repid,REPORT_DESFORMAT,'pdf');
SET_REPORT_OBJECT_PROPERTY(repid,REPORT_SERVER,'rep_online_FRHome');
SET_REPORT_OBJECT_PROPERTY(repid,REPORT_OTHER,'paramform=no p_date_from='||v_date_from||'p_date_to='||v_date_to);
--SET_REPORT_OBJECT_PROPERTY(repid,REPORT_OTHER,'paramform=no');
v_rep := RUN_REPORT_OBJECT(repid);
rep_status := REPORT_OBJECT_STATUS(v_rep);
WHILE rep_status in ('RUNNING','OPENING_REPORT','ENQUEUED')
LOOP
rep_status := report_object_status(v_rep);
END LOOP;
IF rep_status = 'FINISHED' THEN
/* Display report in the browser */
WEB.SHOW_DOCUMENT('http://'||:GLOBAL.G_IP||'/reports/rwservlet/getjobid'||substr(v_rep,instr(v_rep,'_',-1)+1)||'?','_blank');
ELSE
message('Error when running report');
END IF;
END;
Regards:
Muhammad Nadeem -
Sending more than one name value pair via ajaxRequest.add()
Hi all,
I'm implementing AJAX in Oracle Application Express to perform DML operations on a table. I need to send more than one name value pair via the ajaxRequest object. Can someone guide me how to achieve this? Say for example i need to send 2 values(need to send 2 form elements when submit button is clicked) P3_region and P3_scope. i tried the following methods.
Method 1:
======
ajaxRequest.add('P3_region',document.getElementById('P3_region').value);
ajaxRequest.add('P3_scope',document.getElementById('P3_scope').value);
Method 2:
======
ajaxRequest.add('P3_region',document.getElementById('P3_region').value,'P3_scope',document.getElementById('P3_scope').value);
Neither of them is fruitful. Can someone guide me how to achieve this?
Regards,
Balaji Radhakrishnan.Hi Roel,
The javascript goes like this.
<script language="JavaScript" type="text/javascript">
function getElement1()
document.getElementById('P3_Element1').value = '';
var ajaxRequest = new htmldb_Get(null,&APP_ID.,'APPLICATION_PROCESS=Element1Process',0);
ajaxRequest.add('P3_Element2',document.getElementById('P3_Element2').value);
ajaxRequest.add('P3_Element3',document.getElementById('P3_Element3').value);
ajaxRequest.add('P3_Element4',document.getElementById('P3_Element4').value);
ajaxRequest.add('P3_Element5',document.getElementById('P3_Element5').value);
ajaxRequest.add('P3_Element6',document.getElementById('P3_Element6').value);
ajaxResult = ajaxRequest.get();
if(ajaxResult)
var wsArray = ajaxResult.split("~");
document.getElementById('P3_Element1').value = wsArray[0];
</script>
The application Process goes like this..
declare
v_Element1 VARCHAR2(60);
begin
select distinct Element1 into v_Element1 from TableA where Element2=:P3_Element2 AND Element3=:P3_Element3 AND Element4=:P3_Element4 AND Element5=:P3_Element5 AND Element6=:P3_Element6;
htp.prn(v_Element1);
exception
when others then
v_Element1 := 'Invalid Header Combination';
htp.prn(v_Element1);
end;
The requirement goes like this..
When i give Element2, Element3,Element4,Element5,Element6 as input in the form page the Element1 should get displayed automatically without refreshing the page. But when i use the above javascript and application process i get the Element1 loaded with some html scripts. I call the javascript using onChange() function.
Regards,
Balaji Radhakrishnan.
Maybe you are looking for
-
Photo Book text font incorrect in preview?
Help! I'm using two fontsin a photo book: papyrus for title and baskerville for all other text. In Aperture 3.4.5 everything is fine. When saving as a pdf or previewing to buy, the baskerville font is misaligned at the bottom and looks totally differ
-
MAIL_ACCESS and ORIg_MAIL_ACCESS not working
i am running a messaging server 6.0 and would like to configure the mappings file with some access controls. the default tables in mappings file like SEND_ACCESS and ORIG_SEND_ACCESS works fine. But i want to control with the super set MAIL_ACCESS an
-
Framework Order After Goods Receipt
Hi, I have a framework order which GR Non Valuated is checked and GR Bsd IV is unchecked. When goods receipt is performed, under PO history in the framework order, the value of the of the GR is shown as 0. Is this standard in SAP? Am I right to say t
-
How to update oracle jdbc driver to 11.1.0.7.0 JDBC Drivers
HI, I got a jdbc exception *" java.lang.ArrayIndexOutOfBoundsException "*. I have known that it is a Oracle JDBC bug and Oracle BUG number is BUG-6396242. The problem is too many rows per database transaction and it is fixed at version 11.1.0.7 Oracl
-
I have Adobe Bridge CS5 Vers.4.00.529.Can I update directly to Vers. 4.5?? Or do I need to go step by step 4.1 to 4.2 ect.??