Sending File object via  UDP

Hello...
i have 2 applications...a server and a client..i want to send a file object or any self declared object from the server to the client application.How can i accomplish this.Do i still have to use byte arrays. Can u help me with this.
Thanks in advance.

Bear in mind that the File object - I'm assuming you mean an instance of java.io.File here - isn't "the file", it's just a handle to the file. Sending that itself is pointless, since it describes a file on your local machine, which will mean nothing to another machine. You need to read in the actual bytes of that file and send them

Similar Messages

  • Sending an InetAddress-object via udp

    hi there!
    i'm developing a videostream server/client application. client is an applet. what i want to do is this:
    since an applet has to be signed in order to perform dns-lookups, i want to work around that.
    since the applet has to request the stream anyway and therefore connects the server sending udp-
    packets, my idea was to let the server send back the clients IP/hostname as an InetAddress-object
    inside a udp packet.
    i tried the following:
    info: byte[] buf = new byte[256];
    on server:
    InetAddress address = packet.getAddress();
    buf = address.getAddress();
    packet = new DatagramPacket(buf, buf.length, address, port);
    socket.send(packet);
    on client:
    socket.receive(packet);
    byte[] temp = packet.getData();
    source = InetAddress.getByAddress(temp);
    System.out.println(source.toString());
    the system.out returns this: ı�A)
    or other unreadable stuff, depending on the ip-address of the client.
    i think, this has something to do with the conversion to/from bytearray, doesn't it?
    can anyone show me how to send an InetAddress-object so that i get an
    InetAddress-object out at the client side?
    thanks in advance!
    you can earn some bucks, too!
    greets
    honfrek

    hi there!
    thanks for your help. i got it figured out now.
    now it works like this:
    on server:
    InetAddress address = packet.getAddress();
    buf = address.getAddress();
    byte[] newbuf = new byte[buf.length];
    newbuf = buf;
    packet = new DatagramPacket(newbuf, newbuf.length, address, port);
    socket.send(packet);
    on client:
    byte[] newbuf = new byte[4];
    packet = new DatagramPacket(newbuf,newbuf.length);
    socket.receive(packet);
    source = InetAddress.getByAddress(packet.getData());
    i made 2 mistakes:
    - i converted the InetAddress to a string
    - the length of the byte[] was too big. i had a bunch of zeroes at the end

  • Error in sending object via a JMS..

    The JMS is giving me error when i am sending an object via a sender...i am using point to point,...and Weblogic server....
    the whole thing of object sending works when i run it in two different consoles...i
    but when i move to webworld....i e tomcat it shows me the following exception.....
    weblogic.jms.common.JMSException: Error deserializing object
    at weblogic.jms.common.ObjectMessageImpl.getObject(ObjectMessageImpl.java:144)
    at intertec.jms.ObjectReceiver1.onMessage(ObjectReceiver1.java:64)
    at weblogic.jms.client.JMSSession.onMessage(JMSSession.java:2596)
    at weblogic.jms.client.JMSSession.execute(JMSSession.java:2516)
    at weblogic.kernel.ExecuteThread.execute(ExecuteThread.java:197)
    at weblogic.kernel.Kernel.execute(Kernel.java:336)
    at weblogic.kernel.Kernel.execute(Kernel.java:360)
    at weblogic.kernel.Kernel.execute(Kernel.java:348)
    at weblogic.jms.client.JMSSession.pushMessage(JMSSession.java:2392)
    at weblogic.jms.client.JMSSession.invoke(JMSSession.java:2919)
    at weblogic.jms.dispatcher.Request.wrappedFiniteStateMachine(Request.java:609)
    at weblogic.jms.dispatcher.DispatcherImpl.dispatchAsyncInternal(DispatcherImpl.java:128)
    at weblogic.jms.dispatcher.DispatcherImpl.dispatchOneWay(DispatcherImpl.java:312)
    at weblogic.jms.dispatcher.DispatcherImpl_WLSkel.invoke(Unknown Source)
    at weblogic.rmi.internal.BasicServerRef.invoke(BasicServerRef.java:466)
    at weblogic.rmi.internal.BasicServerRef$1.run(BasicServerRef.java:409)
    at weblogic.security.acl.internal.AuthenticatedSubject.doAs(AuthenticatedSubject.java:353)
    at weblogic.security.service.SecurityManager.runAs(SecurityManager.java:144)
    at weblogic.rmi.internal.BasicServerRef.handleRequest(BasicServerRef.java:404)
    at weblogic.rmi.internal.BasicExecuteRequest.execute(BasicExecuteRequest.java:30)
    at weblogic.kernel.ExecuteThread.execute(ExecuteThread.java:197)
    at weblogic.kernel.ExecuteThread.run(ExecuteThread.java:170)
    Caused by: java.lang.ClassNotFoundException: intertec.beans.Emp
    at org.apache.catalina.loader.StandardClassLoader.loadClass(StandardClassLoader.java:891)
    at org.apache.catalina.loader.StandardClassLoader.loadClass(StandardClassLoader.java:756)
    at java.lang.ClassLoader.loadClassInternal(ClassLoader.java:302)
    at java.lang.Class.forName0(Native Method)
    at java.lang.Class.forName(Class.java:219)
    at weblogic.jms.common.ObjectMessageImpl$ObjectInputStream2.resolveClass(ObjectMessageImpl.java:305)
    at java.io.ObjectInputStream.readNonProxyDesc(ObjectInputStream.java:1513)
    at java.io.ObjectInputStream.readClassDesc(ObjectInputStream.java:1435)
    at java.io.ObjectInputStream.readOrdinaryObject(ObjectInputStream.java:1626)
    at java.io.ObjectInputStream.readObject0(ObjectInputStream.java:1274)
    at java.io.ObjectInputStream.readObject(ObjectInputStream.java:324)
    at java.util.Hashtable.readObject(Hashtable.java:841)
    at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
    at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39)
    at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)
    at java.lang.reflect.Method.invoke(Method.java:324)
    at java.io.ObjectStreamClass.invokeReadObject(ObjectStreamClass.java:838)
    at java.io.ObjectInputStream.readSerialData(ObjectInputStream.java:1746)
    at java.io.ObjectInputStream.readOrdinaryObject(ObjectInputStream.java:1646)
    at java.io.ObjectInputStream.readObject0(ObjectInputStream.java:1274)
    at java.io.ObjectInputStream.readObject(ObjectInputStream.java:324)
    at weblogic.jms.common.ObjectMessageImpl.getObject(ObjectMessageImpl.java:130)
    ... 21 more
    thanks in advance....
    regards
    ullas

    You are missing a class:
    Caused by: java.lang.ClassNotFoundException: intertec.beans.Emp

  • Cannot send files via Bluetooth from my BB 8310 to my Mac OS X 10.5.5

    Trying to send files/pics via Bluetooth from my BB 8310 to my Mac OS X 10.5.5. with no luck.
    From the menu options from the chosen picture I want to send, I select "send using Bluetooth"
    It then prompts me to select a device.
    I select my MacBook (BB and my Mac obviously paired).
    Then the a File Transfer message tells me : "Failed to Find Service"
    Please help. 
    Thanks

    Tripper: Sorry for my delayed response (very sick dad in the hopsital). Also, sorry I answered the *wrong* question. To transfer files:
    On each Mac OS X 10.5-based Mac, from the Apple menu, choose System Preferences.
    From the View menu, choose Sharing.
    Check (click) the "On" box next to Bluetooth Sharing.
    Close the Sharing preferences window.
    Select the file that you want to transfer.
    Select "Send Using Bluetooth" from the Blackberry menu.
    You will now receive a pop-up asking you to select a device. Select the paired computer you want to transfer the file to.
    The file will start transferring. If you selected "Ask What to Do" in the Bluetooth prefs,you'll get a pop-up on the computer asking you if you want to accept or decline the file transfer.
    That's it. Let me know if you still have problems.
    Good luck,
    Rene

  • Send-file nocache parameter does not appear to work in web server 7U1

    Hi all,
    I tried the nocache parameter on my webserver 7U1 deployment and it appears to have no affect - i.e. the specified files are still cached.
    Reference:
    http://docs.sun.com/app/docs/doc/820-1062/abuli?l=en&a=view&q=nocache
    I tried this on a Webserver 6.1 installation and it worked properly.
    Here's my obj.conf settings:
    <Object name=default>
    NameTrans fn="pfx2dir" from="/pdf/MNFS" dir="/opt/webserver7/https-orion/docs/orion/pdf/MNFS" name="pdf"
    Service method="(GET|HEAD|POST)" type="*~magnus-internal/*" fn="send-file"
    </Object>
    <Object name="pdf">
    Service method="(GET|HEAD)" type="*~magnus-internal/*" fn="send-file" nocache=""
    </Object>
    Any body else have this problem w/ web server 7? Any help would be greatly appreciated.
    thanks,
    Rob

    Hi guys,
    Thanks very much for the help - it was enough for me think more about it and solve the problem.
    To answer mv's question, I did previously try the nocache on the default object and it didn't work either (but I will explain the reason below). I knew the file was cached, by seeing the old file in the browser even when refreshed and when checking the access log, the returned byte size was the same as the old file.
    elving's comments indirectly led me to the problem, and I'm embarrassed to say it was actually an application error. We're using virtual web servers, and I had been modifing the correct obj.conf file (confirmed by server.xml) - the problem was that the application setting was pointing to the same physical server, but using a different hostname - d'oh!
    So in other words, I was updated the conf file correctly for virtual server aaa.com, but the app was set to bbb.com (same physical machine), so the same file was being retrieved but my nocache directives for aaa.com we're being ignored.
    Anyway, thanks again everyone for their help - much appreciated!!
    cheers,
    Rob

  • Sending file paths through iChat

    Hi all,
    Since upgrading some of our machines at the office to Snow Leopard we are having a strange issue with iChat that I hope someone has some insight into.
    When all of the machines at our office ran Leopard and iChat 4, we used to send linkable file paths to folders on our server to one another via iChat so we could avoid having to write "go to Jobs, then to Current, then Posted, and the file is in there."
    We would achieve this by opening up a firefox window, then dragging a folder from our server into the window. It would generate a filepath that looked like "file:///Volumes/Server/Jobs/New/transfer/" in the URL bar which could be copied and pasted into iChat and would appear as a linkable URL. Then we started using a program called Get File Path by Alpha Omega Software (http://alphaomega.software.free.fr/), a great drag and drop app which did the same thing with great results.
    However, on machines that now run Snow Leopard (10.6.2 or 10.6.4) and iChat 5 (5.0.1 or 5.0.3), neither of these tricks will work anymore. The message returns an alert saying that the message couldn't be delivered, and that an "AIM service error occurred."
    We have done some more testing on this issue, trying to narrow down its cause. We have found:
    -Workstations using OS X 10.5.8 and iChat 4.0.8 CAN send file links via AIM IM chats to machines using OS X 10.6.4 and ichat 5.0.3. These links work.
    -Workstations running either OS X 10.6.2 with ichat 5.0.1 or OS X 10.6.4 with ichat 5.0.3 CANNOT send file links to anyone using AIM IM chats (even if these links are typed in manually and not copied and pasted) without getting a returned error.
    -Workstations running either OS X 10.5.4, 10.6.2 or 10.6.4 CAN send file links to back and forth to one another via Bonjour IM chats.
    -Workstations running OS X 10.6.2 with Adium 1.3.10 CAN send file links to via AIM IM chats to machines using OS X 10.6.4 and ichat 5.0.3. These links work.
    -Workstations running OS X 10.6.4 with Adium 1.3.10 CANNOT send file links to via AIM IM chats to anyone using AIM IM chats
    We don't have Adium on any of our other workstations, but just installed it to try to narrow down the cause of the problem. I have not messed around with any of the port configurations for iChat (I am not an IT guy so I don't want to screw anything up), but I did note that the port number in iChat is 5190 on all machines -- those that work and those that don't. Additionally I should mention that we are currently connected to a smb share using linux, but we also tested it linking to files one of our leopard servers. It made no difference in the results of the testing.
    What all this tells me that the error is coming predominantly from the update of OS X 10.6.4 (possibly coupled with ichat 5) and the way it sends out AIM IMs. The easy answer would be to just use Bonjour chats, but a lot of people at our office hate using it, and I am hoping to figure out some way to get this to work with iChat AIMs.
    Does anyone know why this is happening? Is there something obvious we are missing? These tricks used to be real timesavers, and it is annoying they are no longer working. If anyone else has some insight I would be greatly appreciative.
    Thanks in advance!
    -Adrian

    The [url http://java.sun.com/docs/books/tutorial/]Custom Networking tutorial has a section on using sockets within a Client/Server context.

  • How does one send a file via UDP?

    I need to send a binary file via UDP. The file has 99 32-bit binary words of data. How do I input the data to the UDP write command? I don't want to send the data sequentially..I would like to send all 99 words in a single UDP transmission. TIA.
    -jlivermore

    Something to be careful of is that while UDP is fast, it is not secure. You can lose packets and there is no way for the sender or receiver to know it was lost. Because UDP doesn't have a "connection" like TCP does, the sender doesn't know if the data is going anywhere and the receivers have no way of knowing if anything is being sent.
    Picture a radio station. A guy working the night shift hopes there is someone somewhere listening to his broadcast, but he doesn't know. Likewise, if you turn on a radio and hear nothing but static, you may be listening to a frequency where there are no stations broadcasting, or the station transmitter might be off the air, or there might be interference keeping you from hearing the signal, but again you don't know which.
    Mike...
    Certified Professional Instructor
    Certified LabVIEW Architect
    LabVIEW Champion
    "... after all, He's not a tame lion..."
    Be thinking ahead and mark your dance card for NI Week 2015 now: TS 6139 - Object Oriented First Steps

  • Sender File Adapter  not able to get file via FTP from an external system

    Hi,
    I have a Sender File Adapter using FTP which polls a server every 10 seconds looking for a file ".xml".  The adapter will connect and pick up the waiting file, but sometimes the adapter not able to get file via FTP from an external system. The file is on the server, but despite the polling, the adapter does not pick up it. There is no return error.
    The connect mode is Permanently and the transfer mode is Binary.
    Can you help me?
    Thanks.
    T.

    Hi Teresa,
    does this case appears with a file size higher the others?
    Personally, I do not recommend to have a polling under 1min.
    10s could be too just, if the file is not small and/or if the file server is far (several kilometers) to where the Adapter Engine is, and/or this file server is beside a firewall. Do not forget also that, with previous points, you could have like a conflict, betwen the 1st polling and the 2nd polling, if in less 10s PI adapter has not enough time: to connect to the FTP server (several Km), find the file (perhaps among 100 other files in the directory), go back to the file to Adapter Engine server (several Km again), convert your file to XML message (with a complex Content Conversion), then check the XML structure, and when all that is done, return back to FTP server (several Km), to archive the source file... Well It's my understanding of a FTP exchange with FILE adapter...
    If you really need a 10s polling, that's mean your have a pseudo real time interface. In that case, in my mind file should not be used! but we should use a Web service, JDBC JMS (any exchange without a physical object like a file). For me, it's a non-sens to have a file in that case.
    regards.
    mickael

  • Sending files via File Adapter through FTP having a HTTP proxy as firewall

    Dear  experts,
    I am having a issue trying to send a file via FTP with the File Adapter. My client has a HTTP proxy with authentification required as firewall  in order to send files via FTP.
    I've tried several solutions but I cannot find a way to add the proxy name, user and password in the communication channel.
    Any ideas?
    Thanks in advance.
    Best Regards

    Hi,
    Unfortunately those changes didn't work. The adapter is not able to establish a connection within the FTP server. These are the parameters I added:
    -Dhttp.proxy.user=<usename>
    -Dhttp.proxy.password=<userpassword>
    -Dhttp.proxyHost=<proxy.domain...>
    -Dhttp.proxyPort=80
    -Dhttp.nonProxyHost="*domain1.com domain2com"
    -Dhttps.proxy.user=<usename>
    -Dhttps.proxy.password=<userpassword>
    -Dhttps.proxyHost=<proxy.domain...>
    -Dhttps.proxyPort=80
    -Dhttps.nonProxyHost="*domain1.com domain2com"
    And just in case, we tried with these other parameters at the same time.
    -Dftp.proxy.user=<usename>
    -Dftp.proxy.password=<userpassword>
    -Dftp.proxyHost=<proxy.domain...>
    -Ddftp.proxyPort=80
    -Dftp.nonProxyHost="*domain1.com domain2com"
    The errors in the adapter engine's log are:
    Error MP: Exception caught with cause com.sap.aii.af.ra.ms.api.RecoverableException: Error when getting an FTP connection from connection pool: com.sap.aii.af.service.util.concurrent.ResourcePoolException: Unable to create new pooled resource: ConnectException: Socket connection timed out: <ftp ip address>
    Error Exception caught by adapter framework: Error when getting an FTP connection from connection pool: com.sap.aii.af.service.util.concurrent.ResourcePoolException: Unable to create new pooled resource: ConnectException: Socket connection timed out: <ftp ip address>
    Error Delivery of the message to the application using connection File_http://sap.com/xi/XI/System failed, due to: com.sap.aii.af.ra.ms.api.RecoverableException: Error when getting an FTP connection from connection pool: com.sap.aii.af.service.util.concurrent.ResourcePoolException: Unable to create new pooled resource: ConnectException: Socket connection timed out: <ftp ip address>
    By the way, we are using  PI 7.0.
    Thanks in advance
    Edited by: SAPIMSA . on Apr 20, 2011 4:08 PM

  • I cant successfully send files from pages via email on my ipad

    The files i send from pages via mail hardly ever send, and when they do i am unable to open the file in the mail, i am having the same truble with sending files from the photo library from my i pad

    Try a Reset [Hold the Home and Sleep/Wake buttons down together for 10 seconds or so (until the Apple logo appears) and then release

  • Send complex data via web service : discards parts of complex object sent

    Hi,
       I have to send an object to the server via a web service. The object A (say) that is being sent has a lot of properties. Now A has an array collection of objects of type B which in turn has an array collection of type C and so on..
    The problem is some of the data is not a part of the xml data sent out.
    I have included the snapshots of the data given to the web service and data sent out as seen in the network monitor below.
    Object sent to the web service
    xml data sent out as seen
    in the request body in the Network monitor
    The object in red rectangle above is of type "Slide" which has an object "caption" of type Caption and other simple properties like slideId (int), slideNumber(int) and storyBoardId(int).
    The object in the red rectangle is the xml data of "Slide" corresponding to the object in the red rectangle in the image to the left.
    Notice that the entire object "caption" has been dropped while the simple properties have been represented.
    I am stuck and cant find a solution to this issue or a work around
    any pointers would be really helpful.
    thanks in advance

    Posting more images .. have simplified the object a lot but still have the same issue.
    1. The request object description as given in the asmx [seen in the browser]
    2. The request object's description as given in the wsdl [seen in browser]
    3. The object that is being sent to the web service -- as seen in the debugger of Flash builder
    4. The object data in xml being sent out of Flex client -- as seen in network monitor of Flash Builder
    NOTE : The object data as seen in the network monitor doesnt have the caption" part at all! whereas the debugger shows the caption.
    5. The object recieved at the web method  of the web service -- as seen in the debugger of visual studio running the service
    If anyone has any work around for this pl let me know.

  • Create summary file as part of export and send with photos via ftp?

    I've looked this forum quite a bit tonight, but I'm under a tight deadline, so I'm going ahead and posting.  Excuse me if I'm asking something that is answered elsewhere in the forum.
    I need to add a step to a custom FTP export plugin that will generate a summary file of the export, including some user input information.
    Can anyone point me to a specific tutorial or sample for this type of thing?  This would be something similar to LR/Transporter, but need to be included in the same plugin, not as an extra step by the user (i.e., it could be a post processing action, but can't be another whole plugin and step for the Lightroom user).
    Essentially being able to generate either an XML, CSV or general text file that would be FTP'd along with the photos, with custom data written into that file that would include data provided by the user in custom dialog during the export process.
    Thanks in advance,
    Ed M.

    You've probably already worked this one out but I thought I
    would post my solution - not elegant but it works
    I spent two days trying to find an asp.net solution in VB.net
    to no avail so here goes:
    Actionscript:
    var bitMD:BitmapData = new BitmapData(this.width,this.height)
    bitMD.draw(this);
    var _PNG:ByteArray = PNGEncoder.encode(bitMD);
    var U:URLRequest = new URLRequest
    U.method = URLRequestMethod.POST
    U.data = _PNG;
    U.contentType="application/octet-stream";
    U.url = "
    http://localhost/CARTO/image.aspx";
    var UR:URLLoader = new URLLoader
    UR.dataFormat = URLLoaderDataFormat.TEXT
    UR.load(U);
    ASP.NET
    Protected Sub Page_Load(ByVal sender As Object, ByVal e As
    System.EventArgs) Handles Me.Load
    Dim b() As Byte = Request.BinaryRead(Request.TotalBytes)
    Dim ms As MemoryStream = New MemoryStream(b)
    Dim img As System.Drawing.Image = Bitmap.FromStream(ms)
    Dim bmp As Bitmap = New Bitmap(img)
    Dim tempStream As New MemoryStream()
    bmp.Save(tempStream, System.Drawing.Imaging.ImageFormat.Png)
    Dim fs As New
    FileStream(System.Web.HttpContext.Current.Server.MapPath("test.png"),
    FileMode.Create)
    tempStream.WriteTo(fs)
    tempStream.Close()
    fs.Close()
    End Sub

  • How do I send a file that is 2 mb via adobe send file now. I have the student version of cs 6

    How do I send a file that is 2 mb via adobe send file now. I have the student version of cs 6. Does this cost money, or can I send a certain size for free. I just want to send a file so I can access it on my ipad. It's a PDF that is too large to email.

    Adobe Send can certainly do that.
    Or you can do it manually:
    upload the file to Acrobat.com
    check the file on the Acrobat.com site and click Send
    use Create Anonymous Link and click the Create Link button
    copy the created download link and send it by email

  • G5 crashes when I try to send files via iCHAT

    No idea whats causing it but when I try to send files via ichat it gets about 10mb in and then the machine crashes....
    Don't think its to do with my broadband connection as this seems stable and am not running any other programs in the background.......Desparate to sort this -please help.

    Hi Mart06,
    Welcome To The Apple Discussion Pages.
    I can not find anything on the AIM site that suggests there is a Limit on file sizes.
    The largest one I have tried myself was 9.2Mb
    The closest thing I could find to the point in question was the last question on this page.
    If the file is not stuffed so far you could try that to make it smaller.
    I have AIM 4.7 for Mac and can not see any info in the Help there about any limit to the size of File Transfers.
    4:12 PM Wednesday; March 8, 2006

  • Cannot send files via bluetooth from phone to PC

    Dear All,
    I am having a problem trying to send files from my E71 to a PC.
    I can send files from my PC's (both Ubuntu & Windows) no problem but if I try to send a file from my E71 (i have tried both a pdf, picture & video) the phone just says "Sending failed".
    I can browse the phone via blueetooth in both Ubuntu and Windows so i know the connectivity is there. Both Ubuntu and Windows have the options set to allow incoming file transfers.
    Is this normal behaviour? Has anybody else experienced this problem or seen anything else about this?
    COM

    Hi Com,
    which Bluetooth stack are you running under Windows?
    I know that with the M$ stack, you explicitly need to right-click on the BT icon and choose "Receive a File". I have successfully used this before to get files from my E71.
    Regards,
    Dane
    Proud E71-1 owner (yeah!)

Maybe you are looking for