Sending a array of integer to client

Hi all,
I'm new to socket programming and i had read many tutorials on sending files from server to client using DataOutputStream. Is it possible to send a array of integer out using DataOutputStream? If so any example or tutorial that i can read on? Thanks.

Alternatively, can i convert the array of integer to byte and transfer to the client and covert it back to array of integer again?
Can someone help me with this?
Example:
//I have a array of integer
testArray = new int[10];
int i;
for(i=0;i<10;i++) {
testArray[i] = i;
//I need some code to send this array of integer to a client.

Similar Messages

  • Help :- Send Large File From Server To Client

    Hey guys, I am stuck with a problem.Hope u guys might be able to help me out. My problem is :-
    From client i am doing an operation which results in calculation of results by server and saving a file on the server..But i want to see what results have been computed by the server and hence i want to stream that file back to the client..
    The file may be of 100MB as well , that is, the size of the file may be huge.
    I want u guys to tell me how to stream that file back to the client..I tried returning byte array which gets serialized and then received at client side but as i said the file may be huge so memory problem may arise, so returning byte[] from function is not a good solution..
    I am looking something where server can send the file back to the client in chunks..Client keeps receiving these chucks and keep putting them in the file.
    So how to make server send file in chunks??Also, i don't know the hostname and ports...so sockets i can't use...
    Any Another way to do it...??
    is PipedStream a solution??
    Please guys, help me
    Thanks in advance
    Edited by: 854509 on Apr 25, 2011 8:28 AM
    Edited by: 854509 on Apr 25, 2011 8:59 AM

    854509 wrote:
    I knew about sockets but as i said i am able to send request to server by client by calling a remote method...There i haven't used sockets...RMI uses sockets, I assume you mean you don't access to the underlying socket.
    So i wanted to know if we can without using sockets send file back to Client..I would have the RMI return the connection details where the result can be obtains, .e.g with hostname, port, and file name to use.
    I would suggest trying to compress the stream as well (just wrapp the stream on the sender/reciever), especially for files over 1 MB.
    Tell me something abt PipedStreams as well..If they are of any use here or not?I don't see how. PipedStreams can be used to share data between threads in the same process.
    If RMI is your only choice you can perform a method which would return alot of data and have seperate methods to download portions of it.
    e.g.
    public int loadBigFile(String filename); // returns the number of portions.
    public byte[] returnPortion(int n);
    int portions = rmi.loadBigFile("my-big-file.xml");
    for(int i=0;i<portions;i++) {
       byte[] bytes = rmi.returnPortion(i);
       // do something with bytes.
    }You can have the server cleanup the file when the last portion is read.

  • How do i send an array of clusters with variable size over TCP/IP?

    Hi,
            I'm trying to send an array of clusters with varible size over TCP/IP,. But I'm facing the following problems:
    1) I need to accept the size of array data from the user and increase the size dynamically.
    I'm doing this using the property node but how do I convey the new size to my TCP read?
    2) I need to wire an input to my 'bytes to read' of the TCP read.
    But the number of bytes to read changes dynamically
    How do I ensure  the correct number of bytes are read and reflected on the client side?
    3) Is there anyway I can use global varibles over a network such that their values are updated just as if they would on one computer?
     Will be a great help if someone posts a solution!
    Thank you...

    twilightfan wrote:
    Altenbach,
     ... xml string. ...number of columns that I'm varying using property node s... I solved these problems by using a local variable as the type input ...o TCP read is creating a problem.... second TCP read gets truncated data because
    its no longer just the first four bytes that specify the length of the data, it could be more as my array of cluster can be pretty huge.
    Instead of writing long and complicated sentences that make little sense, why don't you simply show us your code? 
    What does any of this have to do with xml strings???? I don't see how using a local variable as type input changes anything. The user cannot interact with "property nodes", just with controls. Please clarify. Once the array of clusters is flattened to a string you only have one size that describes the size of the data, no matter how huge it is (as long as it is within the limits of I32). Similarly, you read the string of that same defined length and form the array of clusters from it. How big are the strings? What is your definition of "huge"?
    Here's is my earlier code, but now dealing with an array of clusters. Not much of a change. Since you have columns, you want 2D. Add as many diensions you want, but make sure that the control, diagram constant, and indicator all match.
    The snipped shows for a 1D array, while the attached VI shows the same for a 2D array. Same difference.  
    Message Edited by altenbach on 01-31-2010 01:13 AM
    LabVIEW Champion . Do more with less code and in less time .
    Attachments:
    FlattenArrayOfClusters.vi ‏12 KB
    ioclusters3MOD.png ‏25 KB

  • Trouble with sending huge arrays via DataSocket​s.

    Hi,
    I am having trouble sending huge arrays via Data Sockets from my main vi on the server PC to the vi on the client PC.
    To further elaborate, in my main vi program I have created 3 arrays called Array1, Array2 and Array3 on my front Panel. By right clicking the mouse on each set of array and from the pop-up menu I selected Data Operations-> DataSocket Connection and I entered dstp://localhost/Array1 and clicked on Publish to broadcast the data from Array1. Similarly, I did the same for Array2 and Array3.
    Now, in my client vi program I have created three arrays on my front Panel to read (Subscribe) the data from the three arrays broadcasted via DataSockets from the server’s main vi program. To subsc
    ribe the data I did the similar process above and clicked on Subscribe to read the data (of course the IP address of the client PC will be different then the server PC so enter the hosts IP address). Once the data is received in the client arrays, I am using LV2 globals so that I can use these arrays on other sub-vi’s locally (instead of having each sub-vi get data from the server directly).
    I succeeded in doing this with two arrays, however when I added the third array the DataSockets would not work consistently. For example the refresh rate would get slower at times and sometimes 2 out of the 3 arrays would update. I don’t know if I have exceeded the limit on how much data DataSockets can broadcast, but I need to have some mechanism to broadcast 6 arrays (approx. 10000 elements for each array) of double digits precision.
    Has anyone come across this issue? Is there another way of broadcasting data more efficiently then DataSockets?
    I would appreciate any
    help that I can get.
    I have attached the files for this program in the zip file.
    First run the Server main program, testServeMainVI.vi, and then the client program, testClientMainVI.vi.
    Thanks
    Nish
    Attachments:
    beta2.zip ‏70 KB

    DataSocket can be a lossy communication. I like the advice to flatten the data to a string, but another option would be to buffer the communcation. The problem might be that the data is being overwritten on the server faster than it is being read. There is an example of buffered datasocket on NI web page: http://venus.ni.com/stage/we/niepd_web_display.DIS​PLAY_EPD4?p_guid=BA3F9DFED17F62C3E034080020E74861&​p_node=DZ52000_US&p_submitted=N&p_rank=&p_answer=&​p_source=Internal
    Also, I have played with the new built in buffered datasocket in LabVIEW 7.0. It is pretty slick. If buffers the data both on the server and the client side.

  • Sending email using system default mail client on linux and Mac

    Want to send e-mail using defalut mail client of Linux, Mac OSX, others.

    Your question may be about mail, and your question may be about Java,
    but the JavaMail library can't do what you're asking.
    I know of no platform-independent way to do what you're asking.
    You can write lots of platform-dependent code - to do it with Outlook
    on Windows, to do it with AppleMail on MacOS, to do it with Thunderbird
    on Linux - but I know of no way to do it with whatever mail client the
    user has configured on any system.
    Sorry.

  • Sending an email using the gmail client on the iPhone

    Hello,
    When I send an email using the gmail client on the iPhone, the message I send then shows up in my 'in box' and not my 'sent' box. Mail app on my computer behaves in the same manner. Is there a fix for this?
    Thanks for your help.

    Hi, its because gmail treats each message as a "conversation" rather than emails sent or recieved. so your sent email will say "from me" all in the same inbox. check this on the web based gmail...

  • I would like to send a Pages document to a client who can then manipulate and change the file.  How can I do that with OSX 10.6.8?

    Can I send a Pages document to a client who can then manipulate or change them on their end?

    You can export the Pages document to Word or text instead of Pages but I advise you to first save the document in the native Pages format. Still best is if you reciever get the applicationif you are going to do a lot of editing on documents.
    About setting the computer etc. I don't know what the person was thinking off.

  • No Service for System SAPECC(Sender Port), Client800(R/3 system client 800)

    Hi friends,
    I am new to XI/PI I am working with IDOC to Flat file scenario I am facing the folllowing error.
    No Service for System SAPECC(Sender Port), Client800(R/3 system client 800) in integration Directory.
    can any one tell what was the reason for this error.
    Thanks in Advance,
    Ravi Yasoda.

    Hi Ravi,
    Have you imported the Business System in Integration Directory?
    Check whether  you see the logical system name in adapter specific identifiers or not...
    Also check from integration directory that cache notification was done and also check SXI_CACHE in the abap stack.
    See this thread...
    No service for system SAP***, client 001 in Integration Directory
    Please go through below content from sap note  for your issue...
    Error message: No service for system SAPABC client 123 in the integration directory
    Solution:
    You send IDocs from system ABC to XI. In the control record of the IDoc,the SNDPOR field contains the value "SAPABC". The client of the sending system is determined by the MANDT field of the control record. The system ID and client are then used to determine a service without party of the
    type (business-system/business-service):
    Business system
    -> Activities in the System Landscape Directory (SLD)(Create technical
    system):
    Create a technical system for system ABC in the SLD, and create the client for this. Do not forget to assign an "ALE logical system" (for example, "ABCCLNT123") to this technical system.
    SLD (Business system):
    You can now explicitly assign a business system to this client. For more details, refer to the SLD documentation.
    Activities in system ABC (self-registration in the SLD):
    Alternatively, you can register the system in the SLD in system ABC with Transaction RZ70. You will find detailed information about the SLD registration of systems on the SAP Service Marketplace for the
    "Exchange Infrastructure" in the document "Exchange_Installation_Guide.pdf".
    In system ABC, you can check your configuration with Transaction SLDCHECK.
    Activities in Integration Directory (import business system from SLD):
    You will find the business systems under Services Without Party in the Integration Services. In the Service menu, you will find the system identifiers, the client, and the corresponding ALE logical
    system under "Objects"->"Adapter-specific identifiers". Use the Import/Update button to copy the data from the SLD, to create business systems, or to update their identifiers.
    Business service
    -> Activities in the Integration Builder directory:
    You want to create a service without party that is not part of your system infrastructure and is therefore not maintained in the SLD. In the Integration Builder directory, you will find the "Business-Services" under Services Without Party. In the Service menu, you will find the system identifiers, the client, and the corresponding ALE logical system under "Objects"->"Adapter-specific
    identifiers".
    Activate the change list in Integration Directory.
    In system ABC, you can restart the incorrect entry from Transaction SM58 .
    Regds,
    Pinangshuk.

  • Send a Single Message to a Client

    What is the best way to send a single message from the server to a client using flex/blazeds? The one caveat is that the message could take several minutes before it is sent. Think of a long calculation that is done on the server that the client waits for. I've thought of the following options:
    1) Just use a RemoteObject and call a method. Would there be any problems with the response taking several minutes to come back? I would also ideally like to have a single thread which sends all the responses to the clients in a batch, rather than the standard route of each client's remote method call spawning a thread which returns the result; anyone know where to get started here?
    2) Create a new destination and consume that destination on each client. The destination and consumer could be closed on each client after the first message is received.
    Which is the best option?
    Thanks,
    Gordon

    It looks like you need a mechanism where the client registers with the server, then server does some long calculation, and then when the result is available, server sends the result back to the client. Messaging (option #2) sounds like a good fit for this.
    Some thing to note:
    - You can use subtopics so each client is subscribed to the same destination but has its own subtopic to receive updates from.
    - You need to use a realtime channel (polling, long-polling, or streaming) so that the consumer can receive updates. I suggest long-polling with a really long wait time.

  • Send an array to php

    I have to send a large number of variable to php and want to
    avoid having to repeatedly call the php script, so I thought the
    way to do this would be to send an array. I generally use code
    similar to the following to receive individual variables in php:
    $count = mysql_real_escape_string($_GET["count"]);
    Unfortunately, I don't know how to accept an array from Flex
    into PHP. I realize that this is more of a php question than a Flex
    question, but am hoping that someone has done this before. Here's
    how I want to send the array from Flex:

    These links might help:
    link1
    link2
    link3

  • Can anyone send me TCS XI  running projects clients ?

    can anyone send me TCS XI running projects clients?
    please send ASAP..

    HI Bipin and Prasad,
    Please note TBIT40 materials are copyright protected by SAP AG. Distruibution of any such material is ILLEGAL.
    If you need the training material, attend a training course in any SAP authorised training centre.
    Regards,
    Jai Shankar

  • JDBC- passing array of integer to StoredProcedure

    I want to pass an array of integer(JAVA) to stored procedure and read it in the stored procedure. Is it possible ?
    I need the sample JAVA code and the Stored Procedure too.

    Rajganesh,
    This is currently not supported. A workaround is to use Oracle Collection types.
    Simple scalar arrays will be supported by the upcoming 8.1.7 JDBC OCI driver provided that your stored procedure takes PLSQL index-by table arguments.
    Thanks.

  • Send direct print to printer from client, Reports 10G, Windows environment,

    We are using windows 2003 based server. Oracle Form and Report Services . Database 10g . Reports 10G.
    Trying to send direct print to printer from client side using Destination Parameter : Printer.
    I am getting output in pdf at client side. but direct print to printer is failed.

    Make sure that the client printer is also known on the application server, since that is where the print job is generated.

  • Sending an Image file to a client using UDP

    I wants to send an Image file from the client to the server using UDP. As UDP can only sends data of type byte, how can i convert the Image file to byte & send it. Here is the Client program:
    import java.io.*;
    import java.net.*;
    import java.util.*;
    import java.awt.*;
    public class Client {
    public static void main(String[] args) throws IOException {
    if (args.length != 1) {
    System.out.println("Usage: java Client <hostname>");
    return;
    BufferedReader br = new BufferedReader(new InputStreamReader(System.in));
    String str = br.readLine();
    br.close();
    // get a datagram socket
    DatagramSocket socket = new DatagramSocket();
    // send request
    byte[] buf = new byte[65500];
    buf = str1.getBytes();
    InetAddress address = InetAddress.getByName(args[0]);
    DatagramPacket packet = new DatagramPacket(buf, buf.length, address, 4445);
    socket.send(packet);
    // get response
    packet = new DatagramPacket(buf, buf.length);
    socket.receive(packet);
    // display response
    String received = new String(packet.getData());
    System.out.println("Received: " + received);
    socket.close();
    Thanx.

    DataInputStream inStream = new DataInputStream(new FileInputStream(filename));
    try {
    byte bindata = inStream.readByte();
    catch (EOFException eof) {
    }

  • Sending an array of images via web service

    Hi!
    Is it possible to send an array of images using DataHandler[]?
    Thank you!
    Good Day!
    grazieee

    Hi Michael,
    Can I have an example of the JAX-RPC handler method?
    Thank you!!
    Good Day!
    grazieee..
    ================================================================
    "Michael Wooten" <[email protected]> wrote:
    >
    You can return a DataHandler[], but you can't currently pass one to a
    WLS (or WLW)
    web service opertion :-)
    For now, you should consider using a JAX-RPC Handler to achieve the same
    effect.
    Regards,
    Mike Wooten
    "grazieee" <[email protected]> wrote:
    Hi!
    Is it possible to send an array of images using DataHandler[]?
    Thank you!
    Good Day!
    grazieee

Maybe you are looking for

  • Oracle Installer hangs at 18% on a file naeet.o

    Oracle Installer hangs at 18% on a file naeet.o installer also show.. link pending.. machine is 64 bit. with OEL4 64 bit i have oracle 9i R2 64 bit...which i am trying to install... i've installed all the required rpms as described in Oracle-base . P

  • Routines for determine the customer tax classification in VF02

    Hi i have to find out how the customer tax classification values is coming in VF02.customer tax classification  value should be '0'.but in my case it is coming '1'. i have to find out ,how the calculations has to be done and where should i modify the

  • Titles stretched in the timeline in Premiere Pro CS6

    I think it has something to do with the aspect ratio but this was never a problem before for me. I did check the aspect ratio and made sure it was the same, but when I bring the title in to the timeline it's stretched wide. When I'm editing the title

  • Costing BOM usage

    Hi Experts, Please explain me with some examples what is the use of " BOM usage (6)costing BOM". I have the following scenario where i was trying to use the Costing BOM concept. To produce material 'A',  I need component 'B' and 10 other consumable m

  • Editing Flash Template Problem

    I downloaded a flash template and after I edit it in Flash CS3 and preview, something strange happens. The original template is centered in the web browser with a colored background on either side. But, after my edits it defaults to the left side wit