Sending a ResultSet using a Socket

Is it at all possible to send a ResultSet from a Server Application to a Client Application using sockets? I've tried using an ObjectOutputStream but that hasnt helped. Is there anyway to convert the ResultSet to an array and then send the array?
Any help will be most appreciated.

Thank you for the help. I've tokenised the information and inserted it into a vector which i hav then sent to the client. Using it as a vector on the client side. I've found out that ResultSet isnt Serializable hence, cant be sent. Could you perhaps point me to any good sites where i can learn to print, fast?
Thanks again

Similar Messages

  • Sending a File Using DataGram Sockets

    I writting one java program that can be used to transfer a file from one computer to another computer.
    I wrote using Sockets.
    But i want to do that using DatagramSockets. Can we send a file using DataGramSockets?
    Please reply soon.

    You can use DataGram but it is harder.
    One issue is you need to retransmit missing packets. This means you need to keep track of which packets have been sent and be able to send missing ones again.
    If Socket work for you why do you want to use DataGrams

  • [Request For Help] How To Send Email Midlet Using Secure Socket ?

    Hello, this is the first time i ask for help to forum.sun.com.
    i try to make secure connection for send email from MIDlet. Maybe you can check to my code :
    EmailMidlet.java
    import javax.microedition.midlet.MIDlet;
    import javax.microedition.midlet.MIDletStateChangeException;
    import javax.microedition.lcdui.;
    public class EmailMidlet extends MIDlet implements CommandListener{
    Display display = null;
    // email form fields
    TextField toField = null;
    TextField subjectField = null;
    TextField msgField = null;
    Form form;
    static final Command sendCommand = new Command("send", Command.OK, 2);
    static final Command clearCommand = new Command("clear", Command.STOP, 3);
    String to;
    String subject;
    String msg;
    public EmailMidlet() {
    display = Display.getDisplay(this);
    form = new Form("Compose Message");
    toField = new TextField("To:", "", 50, TextField.EMAILADDR);
    subjectField = new TextField("Subject:", "", 15, TextField.ANY);
    msgField = new TextField("MsgBody:", "", 90, TextField.ANY);
    public void startApp() throws MIDletStateChangeException {
    form.append(toField);
    form.append(subjectField);
    form.append(msgField);
    form.addCommand(clearCommand);
    form.addCommand(sendCommand);
    form.setCommandListener(this);
    display.setCurrent(form);
    public void pauseApp() {
    public void destroyApp(boolean unconditional) {
    notifyDestroyed();
    public void commandAction(Command c, Displayable d) {
    String label = c.getLabel();
    if(label.equals("clear")) {
    destroyApp(true);
    } else if (label.equals("send")) {
    to = toField.getString();
    subject = subjectField.getString();
    msg = msgField.getString();
    EmailClient client = new EmailClient(this,"[email protected]", to, subject, msg);
    client.start();
    }and EmailClient.java
    import javax.microedition.io.;
    import javax.microedition.lcdui.;
    import java.io.;
    import java.util.Date;
    public class EmailClient implements Runnable {
    private EmailMidlet parent;
    private Display display;
    private Form f;
    private StringItem si;
    private SecureConnection sc; //SSL
    private InputStream is;
    private OutputStream os;
    private String smtpServerAddress = "smtp.gmail.com"; //SSL
    String from;
    String to;
    String subject;
    String msg;
    public EmailClient(EmailMidlet m, String from, String to, String subject, String msg) {
    parent = m;
    this.from = from;
    this.to = to;
    this.subject = subject;
    this.msg = msg;
    display = Display.getDisplay(parent);
    f = new Form("Email Client");
    si = new StringItem("Response:" , " ");
    f.append(si);
    display.setCurrent(f);
    public void start() {
    Thread t = new Thread(this);
    t.start();
    public void run() {
    try {
    //SSL
    sc = (SecureConnection)
    Connector.open("ssl://"smtpServerAddress":465"); //smtp with SSL port 465
    sc.setSocketOption(SocketConnection.LINGER, 5);
    is = sc.openInputStream();
    os = sc.openOutputStream();
    os.write(("HELO there" "\r\n").getBytes());
    os.write(("EHLO" "\r\n").getBytes());
    os.write(("auth login" "\r\n").getBytes());
    os.write(("dHVnYXNha2hpci50cmlhZGl0eWFAZ21haWwuY29t" "\r\n").getBytes());
    os.write(("dGEuZW1haWxjbGllbnQ=" "\r\n").getBytes());
    os.write(("MAIL FROM:<">\r\n").getBytes());
    os.write(("RCPT TO:<">\r\n").getBytes());
    os.write("DATA\r\n".getBytes());
    // stamp the msg with date
    os.write(("Date: " new Date() "\r\n").getBytes());
    os.write(("From: "+from"\r\n").getBytes());
    os.write(("To: "to"\r\n").getBytes());
    os.write(("Subject: "subject"\r\n").getBytes());
    os.write((msg+"\r\n").getBytes()); // message body
    os.write(".\r\n".getBytes());
    os.write("QUIT\r\n".getBytes());
    StringBuffer sb = new StringBuffer();
    int ch = 0;
    while((ch = is.read()) != -1) {
    sb.append((char) ch);
    si.setText("SMTP server response - " + sb.toString());
    } catch(IOException e) {
    e.printStackTrace();
    Alert a = new Alert
    ("TimeClient", "Cannot connect to SMTP server. Ping the server to make sure it is running...", null, AlertType.ERROR);
    a.setTimeout(Alert.FOREVER);
    display.setCurrent(a);
    } finally {
    try {
    if(is != null) {
    is.close();
    if(os != null) {
    os.close();
    if(sc != null) {
    sc.close();
    } catch(IOException e) {
    e.printStackTrace();
    public void commandAction(Command c, Displayable s) {
    if (c == Alert.DISMISS_COMMAND) {
    parent.notifyDestroyed();
    parent.destroyApp(true);
    } When I try to debug project from netbeans, i found this error :
    Starting emulator in debug server mode on port 2668
    Connecting to 127.0.0.1 on port 2800
    nbdebug:
    Waiting for debugger on port 2668
    Waiting for KVM...
    Running with storage root temp.SonyEricsson_JP8_128x160_Emu10
    KdpDebugTask connecting to debugger 1 ..
    Running with locale: Indonesian_Indonesia.1252
    Connected to KVM
    Connection received.
    Attached JPDA debugger to localhost:2668
    java.io.IOException: error 10054 during TCP read +
    at com.sun.midp.io.j2me.socket.Protocol.nonBufferedRead(Protocol.java:299)+
    at com.sun.midp.io.BufferedConnectionAdapter.readBytes(BufferedConnectionAdapter.java:99)+
    at com.sun.midp.io.BaseInputStream.read(ConnectionBaseAdapter.java:582)+
    at com.sun.midp.ssl.Record.rdRec(+41)+
    at com.sun.midp.ssl.Record.rdRec(+5)+
    at com.sun.midp.ssl.In.refill(+18)+
    at com.sun.midp.ssl.In.read(+29)+
    at EmailClient.run(EmailClient.java:74)+
    Execution completed.
    5145824 bytecodes executed
    9258 thread switches
    1762 classes in the system (including system classes)
    0 dynamic objects allocated (0 bytes)
    0 garbage collections (0 bytes collected)
    debug:
    BUILD SUCCESSFUL (total time: 4 minutes 34 seconds)
    Regard
    Littlebro

    Don't multipost and don't use the browser's back button to edit your posts as that creates multiple postings. I've removed the other thread you started with the same questio.
    Also, don't post to long dead threads. I've blocked your post and locked the thread you resurrected.
    db

  • Can u tell how to send the pictures using datagrams sockets in java

    hi to all, i am making chat application , i am datagrams socket(packets) for sending and receiving messages . datagrams only send and receive messages in bytes . can u tell me how to send the picture to other person using datagrams.
    Thankyou.

    look her
    http://forum.java.sun.com/thread.jsp?forum=31&thread=330989&tstart=0&trange=15
    and look up Serialisation

  • Sending multiple files using one socket

    Hi guys
    I'm working on a simple app that sends multiple files over LAN or I-NET. The problem is that the app run seems to be non-deterministic. I keep getting this error on the client side:
    java.io.UTFDataFormatException: malformed input around byte 5
            at java.io.DataInputStream.readUTF(Unknown Source)
            at java.io.DataInputStream.readUTF(Unknown Source)
            at service.DownloadManager.storeRawStream(DownloadManager.java:116)
            at service.DownloadManager.downloadFiles(DownloadManager.java:47)
            at manager.NetworkTransferClient$1.run(NetworkTransferClient.java:104)The byte position changes every time I run a transfer. The error is caused by this line: String fileName = in.readUTF(); Here's the complete code:
    Client
    private void storeRawStream() {                               
            try {
                FileOutputStream fileOut;                       
                int fileCount = in.readInt();           
                for(int i=0; i<fileCount; i++) { 
                    byte data[] = new byte[BUFFER];
                    String fileName = in.readUTF();               
                    fileOut = new FileOutputStream(new File(upload, fileName)); 
                    long fileLength = in.readLong();                                 
                    for(int j=0; j<fileLength / BUFFER; j++) {
                        int totalCount = 0;
                        while(totalCount < BUFFER) {                       
                            int count = in.read(data, totalCount, BUFFER - totalCount);
                            totalCount += count;                 
                        fileOut.write(data, 0, totalCount);
                        fileOut.flush();
                        bytesRecieved += totalCount;                                  
                    // read the remaining bytes               
                    int count = in.read(data, 0, (int) (fileLength % BUFFER));                                        
                    fileOut.write(data, 0, count);              
                    fileOut.flush();
                    fileOut.close();      
                    transferLog.append("File " + fileName + " recieved successfully.\n");  
            } catch (Exception ex) {
                ex.printStackTrace();
        }Server
    public void sendFiles(File[] files) throws Exception {
            byte data[] = new byte[BUFFER];
            FileInputStream fileInput;                                       
            out.writeInt(files.length);              
            for (int i=0; i<files.length; i++) {   
                // send the file name
                out.writeUTF(files.getName());
    // send the file length
    out.writeLong(files[i].length());
    fileInput = new FileInputStream(files[i]);
    int count;
    while((count = fileInput.read(data, 0, BUFFER)) != -1) {
    out.write(data, 0, count);
    bytesSent += count;
    fileInput.close();
    out.flush();
    Does anybody know where's the problem? Thanx for any reply.                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                   

    Send the length of each file ahead of each file, with DataOutputStream.writeLong().
    When reading, read that long, then stop reading bytes when you've read exactly that length.

  • How to send a file using IOCP?

    When using blocking sockets, all I had to do to send a file was to open the file and loop through it and send it in chunks.
    But I find sending a file using overlapped sockets to be more challenging. I can think of the following approach to do it:
    I open the file and send the first chunk, and I keep track of the file handle and file position.
    Now when I get a completion packet indicating that some data has been sent, I check to see if the socket is currently in the process of sending a file, and if it is, I retrieve the file handle and file position and send the next chunk.
    I repeat step 2 until I reach the last chunk in the file, and then I close the file.
    Is this approach correct?
    Note: I don't want to use TransmitFile().

    This approach is more or less correct, but maybe you'd have to know some more things.
    If send "returns" it means, that you buffer has been copied into the internal buffer of system or the network interface card or whatever... in general it means, that you can free/reuse the buffer you have used, but it doesn't mean, that the data
    has been delivered (it does not even mean it has been sent already).
    That's why I'm normally using some flow-control (messages from the receiver) to verify the real data flow.
    The next point is, that you shouldn't read from the file only after you got the ok that the first chunk has been sent. You should read the data as soon as possible so that you can respond much quicker to a send-complete-message. I'd recommend to send using
    multiple buffers.
    Rudolf

  • How to send packet using tcp socket ?

    hi ,
    i want to using tcp socket to send data in ipv6 environment. but why the data transfer is less than ipv4 environment?
    socket = new Socket("2001:0238:0600::2", 1234);am i wrong ?

    bobby92 wrote:
    why the data transfer is less than ipv4 environment?What do you mean?
    >
    socket = new Socket("2001:0238:0600::2", 1234);am i wrong ?No idea, since I've no idea what you're asking.

  • Sending an image using sockets

    can anybody give an idea about how to send an image using sockets.....
    what i want to do is a client that connects to a server this server has the images...so the client request any image that the server has and display it int the client's frame

    Very good point! The problem ( I told you it was untested!) with the above is that the Image class isn't actually serialisable.
    The solution depends on how you're storing your images and how you're managing them within your server. It also depends on your proposed client. For example, if your client was a browser and your images files on a disk, then you might use:
                        Socket s;
                        // Write out header
                        PrintWriter pw = new PrintWriter(s.getOutputStream());
                        pw.println("Content-Type: image/gif");
                        // And send out data.
                        byte[] buffer = new byte[2048];
                        int count;
                        while((count = fis.read(buffer))>0) {
                             s.getOutputStream().write(buffer, 0, count);
                        s.getOutputStream().close();
                   }although you'd probably be better off using a proper webserver. If you're using a proprietry client, then you can either use Swing's JEditorPane to act like browser and display the image as the server above presents it.
    Otherwise, your client could use the incoming byte stream to create a BufferedImage instance.
    How are you storing your images and how are you presenting them?

  • Send String failed using socket

    Hi all,
    I have just finished a program which send a string client to the host server using simple socket. The program is developed using JBuilder9 and run well in winxp pro. When the same program run in linux (red hat), the host server can only see the connection and close. The string never receive in the server side. The problem is worked out like the following
    -create socket
    -create output stream using "PrintWriter"
    -send string
    -close socket
    Pls. comment on what I should do to debug this problem.
    Thanks,
    Peter

    Hi all,
    Thanks for your assistance. I have log down the following from linux using "tcpdump"
    13:16:48.218624 128.128.2.161.33083 > pmon-srv0.999: P 1:42(41) ack 1 win 5840 <nop,nop,timestamp 158365 0> (DF)
    13:16:48.219105 128.128.2.161.33083 > pmon-srv0.999: F 42:42(0) ack 1 win 5840 <nop,nop,timestamp 158365 0> (DF)
    13:16:48.219742 pmon-srv0.999 > 128.128.2.161.33083: . ack 43 win 64199 <nop,nop,timestamp 2471694 158365> (DF)
    13:16:48.219876 pmon-srv0.999 > 128.128.2.161.33083: F 1:1(0) ack 43 win 64199 <nop,nop,timestamp 2471694 158365> (DF)
    13:16:48.219894 128.128.2.161.33083 > pmon-srv0.999: . ack 2 win 5840 <nop,nop,timestamp 158365 2471694> (DF)
    13:17:59.746088 128.128.2.211.1633 > pmon-srv0.999: P 1:43(42) ack 1 win 17520 (DF)
    13:17:59.756047 128.128.2.211.1633 > pmon-srv0.999: F 43:43(0) ack 1 win 17520 (DF)
    13:17:59.756493 pmon-srv0.999 > 128.128.2.211.1633: . ack 44 win 64198 (DF)
    13:17:59.756989 pmon-srv0.999 > 128.128.2.211.1633: F 1:1(0) ack 44 win 64198 (DF)
    13:17:59.757103 128.128.2.211.1633 > pmon-srv0.999: . ack 2 win 17520 (DF)
    128.128.2.211 is the client in winxp pro
    128.128.2.161 is the client in linux
    pmon-srv is the server
    In the first line of each section, it shows that number of bytes have push to the server. I don't know what should I do next to solve the problem.
    Here is the source code
    public class pconnect {
    String ip_addr;
    String fromServer, toServer;
    int i,port;
    Socket pmSocket;
    BufferedReader pm_in;
    PrintWriter pm_out;
    public pconnect(String ip, int portno) {
    ip_addr=ip;
    port=portno;
    try {
    pmSocket = new Socket(ip_addr, port);
    pm_out = new PrintWriter( pmSocket.getOutputStream(), true );
    pm_in = new BufferedReader( new InputStreamReader( pmSocket.getInputStream() ) );
    } catch (Exception err) {
    System.err.println(err);
    System.exit(0);
    public void sendMsg(String msg) {
    try {
    Thread.sleep(5000);
    } catch (InterruptedException e){}
    if (pmSocket.isConnected()) {
    try {
    System.out.println("Stream Status: " + pmSocket.isOutputShutdown());
    System.out.println("Bound Status: " + pmSocket.isBound());
    pm_out.println(msg);
    if (pm_out.checkError()) {
    System.out.println("Socket error");
    }catch (Exception e){System.out.println("Exception: " + e);}
    try {
    pmSocket.close();
    } catch (Exception err) {
    System.err.println("Closed Error: "+err);
    public static void main(String[] args) {
    System.out.println(args.length);
    System.out.println(args[0]);
    pconnect pconnect1 = new pconnect(args[0],Integer.parseInt(args[1]));
    pconnect1.sendMsg("SET00000000N|ALARM:MBX TEST|c29K1920755D");
    Thanks,
    Peter

  • Error in using the Socket Adapter while deploying the composite

    I am going through a Socket Adapter sample given in Oracle JCA Adapters for Sockets"Oracle Socket Adapter Hello World".
    This sample demonstrates inbound request/response and synchronous outbound request/response modes of communication using using Oracle Socket Adapter.
    The HelloWorld business process takes an input string from the Socket Adapter inbound service and
    publishes the message to the BPEL process.
    The BPEL process invokes the Socket Adapter outbound service and returns the received string using synchronous reply.
    Before going into this sample i did the configuration in the Weblogic server by following the steps below:-
    1)Log into Weblogic server console
    2)Click Deployments in the left pane for Domain Structure
    3)Click Socket Adapter.The settings for SocketAdapter page is displayed.
    4)Click the configuration tab
    5)Click the Outbound Connection Pools tab, and expand java.resource.cci.ConnectionFactory to see connection
    factories
    6)Click eis/socket/SocketAdapter
    7)Set the KeepAlive connection property to true
    8)Save the setting.
    After this i did the necessary configurations in the Socket Adapter Configuration Wizard(Inbound/Outbound).
    The BPEL process has:-
    1)A receive which receives input from a Socket Adapter which serves as an inbound synchronous service.
    2)An invoke acitvity which invokes a socket adapter which serves as a outbound synchronous service.
    3)Two Assign activites to do the necessary assignment.
    After Deploying the sample i encountered with the following errors:-
    <Sep 9, 2012 1:19:48 PM IST> <Error> <oracle.integration.platform.blocks.deploy.servlet> <SOA-21537> <Sending back error message: There was an error deploying the composite on soa_
    server1: [JCABinding] [Middleware.ServerConnection/6.0]Unable to complete unload due to: Cannot locate Java class oracle.tip.adapter.socket.SocketInteractionSpec: Cannot locate Jav
    a class oracle.tip.adapter.socket.SocketInteractionSpec..>
    Can any one please tell me the solution for this error.
    Edited by: 957910 on Sep 12, 2012 1:10 AM

    Did you find a solution for this issue. I see the same error while deploying the same very sample code.

  • Should i use secure sockets for my whole client/server application?

    Hi,
    I have a client server application, and I want to ensure that the login process is secure (i.e. use secure sockets). but I dont know how to switch back to a normal socket once that is done.
    So I am left thinking that i should just use SSL for my whole application, which can last pretty long. But I would rather not. Is there any other way of doing this?
    or should I just encrypt the login info using MD5 or something like that, then send it over an unsecure socket?
    thanks!

    Hey,
    Are you sure you haven't confused JGSS for JSSE?
    Imagine you have a client-server system and you sometimes want data sent over the wire to be encrypted... JGSS offers you this flexibility; if you a encrypted transmission, run ift through JGSS before transmitting it; if you don't want an encrypted transmission, bypass JGSS and just send the transmission.
    The benefit is the security (encryption) isn't hard-wired into you communications protocol i.e. TLS. JGSS has nothing to do with connections it is just protocol for securing messages, not sending them.
    You would need to establish the secure context but this could be done at startup and persist for the duration of you applicaiton invocation. You perhaps might need to implement a mechanism to identify encrypted messages on the receiving peer (so it knows to attempt decryption).
    Admittedly, kerberos seems like one of those 'inside-joke' things. I've come to realise if you don't have some sort of kerberos realm/server against which to authenticate - you need to swap it out as the underlying mechanism. How this is done I'm not sure yet, but I intend to find out today....further down the rabbit hole I go!
    If I discover anything helpful, I will let you know.
    Warm regards,
    D

  • How do I send an Image over a socket ?

    I'm trying to get the output from my webcam and send that data out to a socket. Now the output from the webcam is running I'm just not sure how to send it out over the socket.
    Server.java
    import java.io.*;
    import java.net.*;
    public class Server {
       public static void main(String args[]) {
         ServerSocket serverSocket = null;
         boolean listening = true;
         try {
         serverSocket = new ServerSocket(1354);
         System.out.println("Listening for Connections...");
         } catch (IOException drr) {
         System.out.println("Error Listening :" + drr);
         System.exit(-1);
         try {
         while(listening)
         new ServerThread(serverSocket.accept()).start();
         } catch (IOException er) {
         System.out.println("Error Creating connection:" + er);
         try {
           serverSocket.close();
         } catch (IOException err) {
         System.out.println("Error Closing:" + err);
    }When a connection is made it will start the webcam and send the image.
    ServerThread.java
    import java.net.*;
    import java.io.*;
    import java.awt.*;
    import java.awt.image.*;
    import javax.swing.*;
    import javax.swing.event.*;
    import java.io.*;
    import javax.media.*;
    import javax.media.format.*;
    import javax.media.util.*;
    import javax.media.control.*;
    import javax.media.protocol.*;
    import java.util.*;
    import java.awt.*;
    import java.awt.image.*;
    import java.awt.event.*;
    import com.sun.image.codec.jpeg.*;
    public class ServerThread extends Thread {
        public static Player player = null;
        public CaptureDeviceInfo di = null;
        public MediaLocator ml = null;
        public JButton capture = null;
        public Buffer buf = null;
        public Image img = null;
        public VideoFormat vf = null;
        public BufferToImage btoi = null;
        public ImagePanel imgpanel = null;
        private Socket socket = null;
        Image blah;
        PrintWriter out = null;
        public ServerThread(Socket socket) {
         super("ServerThread");
         this.socket = socket;
        public void run() {
         try {
             out = new PrintWriter(socket.getOutputStream(), true);        
             imgpanel = new ImagePanel();
                 String str1 = "vfw:CompUSA PC Camera:0";
                 String str2 = "vfw:Microsoft WDM Image Capture (Win32):0";
                 di = CaptureDeviceManager.getDevice(str2);
             ml = new MediaLocator("vfw://0");
                try {
               player = Manager.createRealizedPlayer(ml);
                 } catch (Exception npe) {
               System.out.println("Player Exception:" + npe);
                player.start();
             Component comp;
             if ((comp = player.getVisualComponent()) != null) {
               // Grab a frame
               FrameGrabbingControl fgc = (FrameGrabbingControl) player.getControl("javax.media.control.FrameGrabbingControl");
               buf = fgc.grabFrame();
               btoi = new BufferToImage((VideoFormat) buf.getFormat());
               //Send the image over the socket
               out.println(btoi);
         } catch (IOException e) {
             System.out.println("It bombed:" + e);
        public static void playerclose() {
           player.close();
           player.deallocate();
      class ImagePanel extends Panel {
        public Image myimg = null;
        public ImagePanel() {
        public void setImage(Image img) {
          this.myimg = img;
          repaint();
        public void paint(Graphics g) {
          if (myimg != null) {
            g.drawImage(myimg, 0, 0, this);
      }The output I get from running the server is this:
    BufferedImage@c9131c: type = 1 DirectColorModel: rmask=ff0000 gmask=ff00 bmask=ff amask=0 IntegerInterleavedRaster: width = 320 height = 240 #Bands = 3 xOff = 0 yOff = 0 dataOffset[0] 0
    Now how can I turn this into an image If this output is correct?

    HUH?
    I got the one to send the images over the network. I'm now trying to get the exact feed of the webcam and sending that over the network. This is alot more difficult to accomplish but I did see where I messed up my process of sending the images was just having to save the file then open it up put it in a byte array then send that over the network to the client. Once it was at the client i was able to re-construct it and throw it up in the frame. The only problem was lag. So this tells me it would be much more faster if instead of saving the file to send the client and having to reconstruct the image I should just send the webcam feed i used to make the image.
    eh, I guess I didn't need any help.
    Hey no offense or anything but you really have to learn how to spell better.

  • How to send XML packet from external socket server to OSB

    Hi folks,
    How do I use external Socket Server(tcp) to send payload to OSB ?
    I have configured the socket protocol in my OSB. I am also able to send and receive responses by testing my proxy services from OSB itself.
    But now, we want to use some external socket (tcp)server to be able to fire some xml file and then receive response on OSB.
    Please help
    salil

    You need to use a socket client application to send a message to a socket where your proxy is listening. For receiving a message at a socket, configure business service at OSB.
    Regards,
    Anuj

  • Can I re-use a socket  (2 way connection)

    I am sending various types of files across an socket. The files are going accross just fine. I do close the output stream on the client which wraps the socket. However, I would like to keep the socket open and send an XML file back to the client containing some information about what finally happens to the file. However, if I don't close the socket the file remains open and then will get munged. So, I guess I need a way to close the file writer but keep the socket open. Anyone know if this is possible or how to do this?
    Here's my client/server.
    <client>
    ...// basically gets the file name.
    Socket sock = new Socket( host, port );
    File fp = new File(fileName);
    FileInputStream fins = new FileInputStream(fp);
    long fsize = fp.length();
    int bsize = 1024000;
    byte[] bdata = new byte[bsize];
    DataOutputStream o = new DataOutputStream(sock.getOutputStream());
    int n=0;
    while (fsize>0)
    n = fins.read(bdata,0,bsize); // read 1mb from file
    o.write(bdata,0,n); // write it to the socket
    fsize-=n;
    o.close();
    System.out.println("File Sent");
    </client>
    <server>
    public class XMLServer implements Runnable {
    public static int DEFAULT_PORT = 22334;
    private Socket request = null;
    public XMLServer(Socket request) {
    this.request = request;
    public XMLServer(int port) {
    try {
    ServerSocket server = new ServerSocket( DEFAULT_PORT );
    System.out.println( "Server starting" );
    while ( true )
    // Wait for client request
    System.out.println( "Waiting...\n" );
    Socket socket = server.accept();
    System.out.println( "Request from client received. Processing request." );
    // Handle request
    XMLServer handler = new XMLServer( socket );
    Thread thread = new Thread( handler );
    thread.start();
    } catch(IOException ioex) {
    ioex.printStackTrace();
    public void run() {
    try {
    handleRequest();
    } catch(IOException ioex) {
    System.out.println("Error occurred while trying to service request.");
    System.out.println("Server stopped.");
    ioex.printStackTrace();
    System.exit(0);
    public void handleRequest() throws IOException {
    File fp = new File(fileName);
    FileOutputStream fout = new FileOutputStream(fp);
    int bsize = 1024000;
    byte[] bdata = new byte[bsize];
    DataInputStream i = new DataInputStream(request.getInputStream());
    int n=0;
    long totalbytes = 0;
    System.out.println("Receiving file");
    while ((n = i.read(bdata,0,bsize)) > 0)
    fout.write(bdata,0,n); // write it to the socket's stream
    totalbytes += n;
    System.out.println("File Read Complete " + totalbytes + " in length.");
    fout.close();
    System.out.println("File Closed");
    <server>

    You understand your problem completely.
    While convienient, it is not practical to use the
    socket streams that way in your application, because
    Sun early on made the decision that closing a stream
    wrapper always closes the inner stream. (Personally I
    wish they hadn't) Anyway, you'll now have to read the
    file into a byte array first, and send that array over
    the output stream.
    Makes sense?Ahhh.. Ok, so you're saying in order to keep the stream open, I would have to send the file in a packet structure so I can send the server the length of the file (in bytes) and then the file so that the server would know to read N bytes and I could then avoid immediately closing the socket? I guess that sounds ok. Kind o f wierd though.. Maybe I'll just use the ProgressMonitor and let that suffice.
    Eeek, tell me it isn't so...

  • Can't send E-mails using Outlook Express on WRT300N

    Hello, I searched through the forums to find problems similar to mine, but everyone had a different router than mine, plus none of the solutions worked for me.
    I just purchaced and installed my router yesterday. Since the install, I have not been able to send e-mails using Outlook Express, but I do recieve e-mails. I am using the WRT300N Wireless-N Router.
    Trying to get my local news service up and running, and right now, e-mail communication is vital........
    Thanks.
    -Ryan French
    Tampa Bay News Online

    Well of course, but the error message says socket error, which doesn't tell how to fix it. Even the Outlook Express help site doesn't give any suggestions to fix anything, other than "Your internet connection has failed," which is not the problem.
    To the disable firewalls suggestion: I did try disabling my firewalls and all of my virus/ e-mail scan software just to check it out. The thing is, I don't see how my Windows XP Firewall, or anything I've been using could be a problem. Right now, because of the error all my sent e-mails are stuck in the outbox, when I disconnect my router and connect everything back up leaving the router out of the picture, the e-mails are sent out as normal. This problem only occurs with the router connected.
    I also need to stream live audio, and I've heard it's a pain using a wireless router...
    Thanks for the suggestions, hopefully someone will provide the winning suggestion so I don't have to call customer service!

Maybe you are looking for

  • How do I organize my iphoto library on my iphone?  My iphoto library is 60gb of photos and 80gb of video.

    I purchased the 128gb iphone 6+ specifically for the reason of having my entire library of family photos and videos on my iPhone.  Given that combined, my iphoto videos and photos equal over 140gb, I will not be able to fit them all on my new iPhone.

  • My apple TV is preventing me from connecting to iTunes store

    I think my daughter updated my apple tv software (she's 2) two nights ago...since then, I cannot login to itunes to watch tv shows or movies.  All of the shows we have purchased are showing in the cloud, but we cannot access them.  I have tried using

  • Help what does this  mean ERROR ITMS-9000: "OEBPS/package.opf(23)

      Hi All - I am getting this error message - ERROR ITMS-9000: "OEBPS/package.opf(23): element "guide" not allowed here; expected the element end-tag or element "item"" at Book (MZItmspBookPackage) - when I try to upload my epub to the Apple bookstore

  • IPod (Mini) refuse to sort smart playlists

    Hello helpful ones. I've got a rather annoying problem. I have a few smart playlists on my iPod Mini, like most people. I've set my iTunes to NOT autosync with the iPod. This is because the iPod does not have enough storage space for this feature. An

  • XLS Files printing as blank

    Hi, I have a selection of reports some of which print to an XLS file fine and some which just return a blank XLS file when printed via BI Publisher. My primary language is english. I have just upgraded to 3.0.1 to see if that fixes the issues but I s