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) {
}

Similar Messages

  • By using XI shall we send any image files ?

    By using XI shall we send any image files ?

    Hi,
    Its possible to send the image file with XI
    please find here with you the link for step by step procedure
    Sending an Image File Through Exchange Infrastructure in a File-to-Mail Scenario
    https://www.sdn.sap.com/irj/sdn/go/portal/prtroot/docs/library/uuid/6d967fbc-0a01-0010-4fb4-91c6d38c5816
    Exchange Infrastructure Binary Conversion Simplified: A Step-by-Step Image File to Image File Mapping and Conversion Using Java Mapping
    https://www.sdn.sap.com/irj/sdn/go/portal/prtroot/docs/library/uuid/10dd67dd-a42b-2a10-2785-91c40ee56c0b
    Thanks
    Swarup

  • How can i upload a image file to server by using jsp or servlet.

    Hi,
    I m gurumoorthy. how can i upload a image file to server by using jsp or servlet without using third party API. pls anyone send me atleast outline of the source code.
    Pls send me anyone.
    Regards,
    Gurumoorthy.

    I'm not an applet programmer so I can't give you much advice there.
    If you want to stream the file from the server before it's entirely uploaded, then I don't believe you can treat it like a normal file. If you're just wanting to throw it up there and then listen to it, then you can treat it like a normal file.
    But again, I'm not entirely certain. You might be able to stream the start of the file from the server while you're still uploading the end of it, but it probably depends on what method you're using to do the transfer.

  • Sending an Image file via UART

    Hi All,
    1. Is it possible to send an image file( .jpg -1080p) from PC to FPGA(ML605 evaluation board) via UART ?
    2. .jpg to .hex to .txt then  through hyper terminal ? or any  other way ?
    Meganadhan
     

    thanks ignacio
    i will try it letter
    but for sending an image to fpga, can i use realterm?  actually i'm doing image encryption project and the size pixel is 1600X1600, it's very big , but it's ok if it will take a long time for transfer it via UART because i just want to make sure that my alghorithm was true.
     and i have some trouble with the uart rx code. i would like to simulate it with random bit that represent transfer bit from pc, but it's hard to sychronise the timing between uart rx and the random bit program , here the code
    RANDOM BIT
    library IEEE;
    use IEEE.STD_LOGIC_1164.ALL;
    entity random is
    generic (
    g_CLKS_PER_BIT : integer := 87 -- Needs to be set correctly--> 10 MHZ/115200(baud rate)
    Port ( clk :in STD_LOGIC;
    output : out STD_LOGIC);
    end random;
    architecture Behavioral of random is
    signal counter: integer:=0;
    begin
    process (clk)
    begin
    if rising_edge(clk) then
    counter <= counter+1;
    if counter= (g_CLKS_PER_BIT-1) then
    output <= '1';
    elsif counter=55 then
    output <= '0';
    elsif counter=65 then
    output <= '0';
    elsif counter=75 then
    output <= '0';
    elsif counter=85 then
    output <= '1';
    elsif counter=95 then
    output <= '0';
    elsif counter=105 then
    output <= '0';
    elsif counter=115 then
    output <= '0';
    --elsif counter =1 then
    counter <= 0;
    end if;
    end if;
    end process;
    end Behavioral;
    ----------------------------------------------------------------------UART RX
    -- File Downloaded from http://www.nandland.com
    -- This file contains the UART Receiver. This receiver is able to
    -- receive 8 bits of serial data, one start bit, one stop bit,
    -- and no parity bit. When receive is complete o_rx_dv will be
    -- driven high for one clock cycle.
    -- Set Generic g_CLKS_PER_BIT as follows:
    -- g_CLKS_PER_BIT = (Frequency of i_clk)/(Frequency of UART)
    -- Example: 10 MHz Clock, 115200 baud UART
    -- (10000000)/(115200) = 87
    library ieee;
    use ieee.std_logic_1164.ALL;
    use ieee.numeric_std.all;
    entity receive is
    generic (
    g_CLKS_PER_BIT : integer := 87 -- Needs to be set correctly--> 10 MHZ/115200(baud rate)
    port (
    i_clk : in std_logic;
    i_rx_serial : in std_logic;
    o_rx_dv : out std_logic;
    o_rx_byte : out std_logic_vector(7 downto 0)
    end receive;
    architecture rtl of receive is
    type t_SM_MAIN is (s_IDLE, s_RX_START_BIT, s_RX_DATA_BITS,
    s_RX_STOP_BIT, s_CLEANUP);
    signal r_SM_MAIN : t_SM_MAIN := s_IDLE;
    signal r_RX_DATA_R : std_logic := '0';
    signal r_RX_DATA &colon; std_logic := '0';
    signal r_CLK_COUNT : integer range 0 to g_CLKS_PER_BIT-1 := 0;
    signal r_BIT_INDEX : integer range 0 to 7 := 0; -- 8 Bits Total
    signal r_RX_BYTE : std_logic_vector(7 downto 0):= (others => '0');
    signal r_RX_DV : std_logic := '0';
    begin
    -- Purpose: Double-register the incoming data.
    -- This allows it to be used in the UART RX Clock Domain.
    -- (It removes problems caused by metastabiliy)
    p_SAMPLE : process (i_clk)
    begin
    if rising_edge(i_clk) then
    r_RX_DATA_R <= i_rx_serial;
    r_RX_DATA <= r_RX_DATA_R;
    end if;
    end process p_SAMPLE;
    -- Purpose: Control RX state machine
    p_UART_RX : process (i_clk)
    begin
    if rising_edge(i_clk) then
    case r_SM_MAIN is
    when s_IDLE =>
    r_RX_DV <= '0';
    r_CLK_COUNT <= 0;
    r_BIT_INDEX <= 0;
    if r_RX_DATA = '0' then -- Start bit detected
    r_SM_MAIN <= s_RX_START_BIT;
    else
    r_SM_MAIN <= s_IDLE;
    end if;
    -- Check middle of start bit to make sure it's still low
    when s_RX_START_BIT =>
    if r_CLK_COUNT = (g_CLKS_PER_BIT-1)/2 then
    if r_RX_DATA = '0' then
    r_CLK_COUNT <= 0; -- reset counter since we found the middle
    r_SM_MAIN <= s_RX_DATA_BITS;
    else
    r_SM_MAIN <= s_IDLE;
    end if;
    else
    r_CLK_COUNT <= r_CLK_COUNT + 1;
    r_SM_MAIN <= s_RX_START_BIT;
    end if;
    -- Wait g_CLKS_PER_BIT-1 clock cycles to sample serial data
    when s_RX_DATA_BITS =>
    if r_CLK_COUNT < g_CLKS_PER_BIT-1 then
    r_CLK_COUNT <= r_CLK_COUNT + 1;
    r_SM_MAIN <= s_RX_DATA_BITS;
    else
    r_CLK_COUNT <= 0;
    r_RX_BYTE(r_BIT_INDEX) <= r_RX_DATA;
    -- Check if we have sent out all bits
    if r_BIT_INDEX < 7 then
    r_BIT_INDEX <= r_BIT_INDEX + 1;
    r_SM_MAIN <= s_RX_DATA_BITS;
    else
    r_BIT_INDEX <= 0;
    r_SM_MAIN <= s_RX_STOP_BIT;
    end if;
    end if;
    -- Receive Stop bit. Stop bit = 1
    when s_RX_STOP_BIT =>
    -- Wait g_CLKS_PER_BIT-1 clock cycles for Stop bit to finish
    if r_CLK_COUNT < g_CLKS_PER_BIT-1 then
    r_CLK_COUNT <= r_CLK_COUNT + 1;
    r_SM_MAIN <= s_RX_STOP_BIT;
    else
    r_RX_DV <= '1';
    r_CLK_COUNT <= 0;
    r_SM_MAIN <= s_CLEANUP;
    end if;
    -- Stay here 1 clock
    when s_CLEANUP =>
    r_SM_MAIN <= s_IDLE;
    r_RX_DV <= '0';
    when others =>
    r_SM_MAIN <= s_IDLE;
    end case;
    end if;
    end process p_UART_RX;
    o_rx_dv <= r_RX_DV;
    o_rx_byte <= r_RX_BYTE;
    end rtl;
    TOP
    library IEEE;
    use IEEE.STD_LOGIC_1164.ALL;
    entity top is
    port(cl_k: in std_logic
    end top;
    architecture Behavioral of top is
    --component random
    component random is
    generic (
    g_CLKS_PER_BIT : integer := 87 -- Needs to be set correctly--> 10 MHZ/115200(baud rate)
    Port ( clk :in STD_LOGIC;
    output : out STD_LOGIC
    end component;
    --component uart rx
    component receive is
    generic (
    g_CLKS_PER_BIT : integer := 87 -- Needs to be set correctly--> 10 MHZ/115200(baud rate)
    port (
    i_clk : in std_logic;
    i_rx_serial : in std_logic;
    o_rx_dv : out std_logic;
    o_rx_byte : out std_logic_vector(7 downto 0)
    end component;
    --signal
    signal mlebu:std_logic;
    signal enabl:std_logic;
    signal metu :std_logic_vector (7 downto 0);
    begin
    a:random port map( output=>mlebu,
    clk=>cl_k
    b:receive port map( i_clk=>cl_k,
    i_rx_serial=>mlebu,
    o_rx_dv=>enabl,
    o_rx_byte=>metu
    end Behavioral;
    regards
    halim

  • Image file can't be used

    I get the following message when I try to place a movie into my movie page in iWeb. "The image file can't be used because you don't have access priviledges or because it has no content or is corupted". I am using small 30 sec clips that I've imported into iPhoto from my digital camera. They are AVI files. I've place them before with no problem, this is new.
    Any idea what's wrong and what I can do?
    Dual 450 MHz PowerPC G4   Mac OS X (10.4.6)  

    So it sounds like something about your iWeb installation got munged. Something used to work, but now it doesn't work anymore. So it must work somehow. Here are the suggestions that I give to people with these sorts of varied and nonspecific issues with iWeb. So without further ado...
    1. Delete iWeb preference file at: YourHardDrive/Users/yourname/Users/Library/Preferences/"com.apple.iWeb.plist"
    2. Delete iLife Media Browser preference file at: YourHardDrive/Library/Preferences/"com.apple.iLifeMediaBrowser.plist"
    3. Repair startup disk permissions using Disk Utility
    4. Reboot machine
    5. Delete iWeb application (but keep a backup of the Domain file!) and reinstall iWeb 1.0 from original iLife'06 DVD or Recovery Disks and then update directly to 1.1.1 via Software Update.
    These are the top 5 things that seem to garner some kind of positive results from people having similar problems. I know that you have already tried a couple things here, but heck, what do you have to lose? For the record, I doubt that it is your Canon camera.

  • IDVD image files not always burning using Disk Utility

    I am using iDVD 06 to create media, from FCE .mov, and have been using the "Create DVD image file" option so that I can make quick copies for clients as needed. Recently a LOT of my gens, using Disk Utility, have been rejected as 'not verifiable' hence wasting a good disk. Some of them do get created successfully. I am currently using WINDATA DVD+R disks. Not sure if this is an iDVD problem or Disk Utility problem frankly. Have reverted back to creating multiple copies in iDVD after the initial 'slow' burn of the original. Thanks

    I am currently using WINDATA DVD+R disks. Not sure if this is an iDVD problem or Disk Utility problem frankly
    There is a third choice that I think is the most likely problem source - WINDATA DVD+R disks themselves.
    I'm 'not big' on + media for single layer disks anyway, but if you are supplying clients with discs you burned, you really ought to use good quality media like Verbatim or Maxell.
    BTW, I always recommend reducing the burn speed in Disk Utility to 4x or lower (I use 2x)
    F Shippey

  • Insert image file to word document using active X

    Hello,
    I would like to insert an image into my word document (at the end). The image is saved as a bmp file and I'm using LV 8.2.1.
    I would like to do this using Active X (without using report generation toolkit).
    Any idea please ? Thanks in advance.
    J.
    Solved!
    Go to Solution.

    Hi J.
    The method to use is Inline shapes (Add pictures). I have linked an example. You will have to configure it in order for it to be at the end of your document but that shouldn't be a problem for you.
    Best Regards,
    Charlotte F. | CLAD
    National Instruments France
    #adMrkt{text-align: center;font-size:11px; font-weight: bold;} #adMrkt a {text-decoration: none;} #adMrkt a:hover{font-size: 9px;} #adMrkt a span{display: none;} #adMrkt a:hover span{display: block;}
    >> "Du 11 octobre au 17 novembre, 2 sessions en parallèle : bien démarrer - approfondir vos connais...
    Attachments:
    activex image.vi ‏13 KB

  • Same file name from sender to receiver file adapter with out using UDF

    Hi All,
    I am working on FILE TO FILE. My requirement is same file name from sender to receiver file adapter. Is it possible to do using only Adapter Specific message properties?  i mean with out using UDF.
    Thanks
    Karthik

    Hi,
    >>>Is it possible to do using only Adapter Specific message properties?
    yes
    just enable Adapter Specific message properties in sender and receiver channel for file name
    and you're done
    Regards,
    Michal Krawczyk

  • How to flip through multiple image files in a folder using Preview?

    On windows a default image viewing program similar to preview allows a user to press the arrow keys to flip through images within the same folder as the image file originally opened with a Preview-like application.
    How can a person filp through images in the same folder with a few keystrokes using Preview?
    thanks

    hmm...you mean there isn't a way to simply skim
    through images in a folder using an arrow or page-up
    key?? That's kind of disappointing...especially
    being forced to pre-select images...
    oceanbluesky,
    There's no reason you can't use Preview to do what you're trying to do. And there's no need to pre-select images.
    The trick is to open Preview first, and then choose Open from the File menu (or Command + O on the keyboard). When Preview's Open dialog window appears, navigate to the folder which contains your pictures. Highlight the entire folder and then press the Open button. Once the folder is open in Preview you should be able to use your arrow keys to flip through...
    Note: To avoid a storm of images from opening on your desktop, go to Preview > Preferences > Images and make sure that the "Open each image in its own window" radio button is not selected.
    Good luck!
    Andrew99
    iMac 1 GHz Flat Panel 15" PPC 768 MB RAM   Mac OS X (10.4.10)  

  • Storing image file in ms-access using jdbc

    Dear all,
    When i try to store a image file in MS-Access, I try it using OLE Object type in ms-access and object type in Java but i got following exception
    java.sql.SQLException: SQL Exception : Unknown SQL Type for PreparedStatement.setObject (SQL Type=1111
    So anyone please guide me that how to store an image file into ms-access database using the jdbc.
    ishan

    Do you want to store the text from the file? or the actual file?
    If you want to store large amounts of raw text, then you can use the MEMO type, but it will only store up to 64kb (65,535 characters). If you want to store the actual file, you'll have to use a field of OLE type.
    Does this answer your question? or were you asking something else?

  • Can't send any image files

    I'm having an issue sending image files. I can send anything else just fine, but when i try to send anyone (a group or just one person) a picture file of any kind, it shows up exactly like the picture I've included, and the other people or person dont see that i've tried to send anything at all. We have have each other added as contacts, and we're all online when i go to do it. Everyone else can send me pictures, but i cant send them out. I also cant change any group display pictures at all, even though I'm an admin of the groups and have permissions to do so. This has been going on for about a week now. I have tried uninstalling and re-installing skype. I've tried deleting the shared.xml file. I've tried asking skype to check for updates. My internet explorer is up to date. Note in the image, the small 'not delivered' loading icon that appears against my contact list pane, in a very strange place for it to be at all. I tried doing skype chat support, and the agent i connected to accessed my computer remotely, and ended up having connection issues, and asked me to do the majority of the work before i finally gave up and closed out of the session, because they didn't know what else to try. 
    If anyone has any advice, please let me know. 
    Solved!
    Go to Solution.
    Attachments:
    fuck iT.JPG ‏23 KB

    Reset all Internet Explorer settings:
    http://support.microsoft.com/kb/923737
    Next reset LAN settings:
    Open Internet Explorer. Go to Tools -> Internet Options -> Connections -> LAN settings. Make sure that the only option selected is “Automatically detect settings”.
    Next clear all Temporary Internet Files:
    Open Internet Explorer -> Tools -> Internet Options -> General. In the section “Browsing history” press the “Settings” button and in the next window the “View files” button. Delete all files from the Temporary Internet Files folder.
    Reboot your computer and test now what happens when you open this link in your Internet Explorer.
    https://api.asm.skype.com/s/i

  • Send updated xml file to the client with out any request

    hi,
    I am showing the data in the form of a table ,where the data are taken from a XML file. If i change the content of that XML file, the server should send the updated data to that client page, that means the client page should get refreshed automatically when there is a change in that XML file. I dont have any idea to implement this requirement.This is very urgent. Any suggestion would be appreciated. Already i have referred www.pushlets.com but that is not so clear. so pls............
    With regards
    Parameswaran

    The client is not supposed to know the server. You will need to have a periodic refresh. :)

  • Sending attachments the file extension is dropped, using Mac?

    When I send attachments (various file types) the people receiving the file does not have an extension. Is there a setting on my Mac or Thunderbird that is hiding the extension??

    It's more likely that your recipients have their systems set to "hide extensions for known file types", which is the default Windows setting. Although, it's also possible, for some file types, that TB fails to properly encode the attachment.
    What happens when you send attachments to yourself, or receive attachments from others?

  • Retrieve image file from FORMS 10G using BLOB

    Dear all,
    i inserted one record in a table for the following procedure.
    Create Or Replace Procedure Blob_Xl Is
    l_blob Blob;
    l_bfile Bfile;
    Begin
    Insert Into LOB_TABLE Values ( 'TEST1', Empty_Blob() )
    Returning BLOBDATA Into l_blob;
    l_bfile := Bfilename( 'TEST1', 'I.JPG');
    dbms_lob.fileopen( l_bfile,dbms_lob.file_readonly );
    dbms_lob.loadfromfile( l_blob, l_bfile, dbms_lob.getlength( l_bfile ) );
    dbms_lob.fileclose( l_bfile );
    Commit;
    End Blob_Xl;
    after that
    record also inserted, i check thro count.
    i try to retrieve that image from that table for using following procedure, in that procedure i called from one button in forms 10g and wrote in when button pressed , when i clicked it wont show any images.
    where i am wrong?
    Create Or Replace Procedure get_img As
    vblob Blob;
    buffer Raw(32000);
    buffer_size Integer := 32000;
    offset Integer := 1;
    Length Number;
    Begin
    owa_util.mime_header('image/JPG');
    Select BLOBDATA Into vblob From LOB_TABLE Where No = 'TEST1';
    Length := dbms_lob.getlength(vblob);
    While offset < Length Loop
    dbms_lob.Read(vblob, buffer_size, offset, buffer);
    htp.prn(utl_raw.cast_to_varchar2(buffer));
    offset := offset + buffer_size;
    End Loop;
    Exception
    When Others Then
    htp.p(Sqlerrm);
    End;
    /

    hi
    try something like this for retrieve.May it helps u.
    DECLARE
    directions CLOB;
    directions_1 VARCHAR2(300);
    directions_2 VARCHAR2(300);
    chars_read_1 BINARY_INTEGER;
    chars_read_2 BINARY_INTEGER;
    offset INTEGER;
    BEGIN
    --Retrieve the LOB locator inserted previously
    SELECT falls_directions
    INTO directions
    FROM waterfalls
    WHERE falls_name='Munising Falls';
    --Begin reading with the first character
    offset := 1;
    --Attempt to read 229 characters of directions, chars_read_1 will
    --be updated with the actual number of characters read
    chars_read_1 := 229;
    DBMS_LOB.READ(directions, chars_read_1, offset, directions_1);
    --If we read 229 characters, update the offset and try to
    --read 255 more.
    IF chars_read_1 = 229 THEN
    offset := offset + chars_read_1;
    chars_read_2 := 255;
    DBMS_LOB.READ(directions, chars_read_2, offset, directions_2);
    ELSE
    chars_read_2 := 0;
    directions_2 := '';
    END IF;
    --Display the total number of characters read
    DBMS_OUTPUT.PUT_LINE('Characters read = ' ||
    TO_CHAR(chars_read_1+chars_read_2));
    --Display the directions
    DBMS_OUTPUT.PUT_LINE(directions_1);
    DBMS_OUTPUT.PUT_LINE(directions_2);
    END;
    sarah
    Edited by: S@R@h on Oct 7, 2009 11:29 PM

  • Image Files - Within Database, or Use FileStream?

    I have millions of photos tied to transactions.  There are several photos tied to one transaction.  My app pages and displays hundreds of transactions with the photos.  I would also like a user to be able to download all of the transaction
    information including the photo to a spreadsheet.  Currently, the images are stored within the database - is this the best way to go?
    Considerations -
    I am currently using transactional replication to replicate this SQL database to another location and the database for the images is 25GBs and will continue to grow.
    The images do not change but daily hundreds more transaction and images are added to the system.
    I know there is a newer method - FileStream.  Should I be using this method and FileTable? I know I can't use Database mirroring with this option (is that a concern) and am currently using transactional based replication.
    What backup method should I use with the recommended database deign - replication or ?

    Consider FileTable for your application.
    BOL: "The FileTable feature brings support for the Windows file namespace and compatibility with Windows applications to the file data stored in SQL Server. FileTable lets an application integrate its storage and data management components, and provides
    integrated SQL Server services - including full-text search and semantic search - over unstructured data and metadata.
    In other words, you can store files and documents in special tables in SQL Server called FileTables, but access them from Windows applications as if they were stored in the file system, without making any changes to your client applications."
    LINK: http://msdn.microsoft.com/en-us/library/ff929144.aspx
    Kalman Toth Database & OLAP Architect
    SQL Server 2014 Database Design
    New Book / Kindle: Beginner Database Design & SQL Programming Using Microsoft SQL Server 2014

Maybe you are looking for

  • Cannot copy photos from iPhoto to iPod Nano

    Hello all, This is my first post so please be gentle! I have just purchased a new Nano. Everything works fine and dandy apart from viewing photos. I have set up the Nano via iTunes to copy (sync) all photos. iTunes then optimises the photos and state

  • Acrobat Pro 11 2nd Display Problem

    iMac 2013 version running OSX 10.9.4 and Acrobat Pro 11.0.7 - both are the most current version. The iMac has a 27" display and I use a second monitor next to it in the portrait orientation, a 23" NEC E231W so I can view fine print documents more eas

  • My computer dosen't even detect my iPod mini

    When I plug my iPod in, my computer dosen't even detect it. This is really odd.. What the **** can I do? I can't restore it, update it, nothing! I needs some help! It is formatted for Mac, but I can't format it to Windows if my computer won't even de

  • Settlements from revenues/debit-side down payments to receiver fixed asset

    Hi while settling the WBS to AUC i am getting the below error settlements from revenues/debit-side down payments to receiver fixed asset  is not allowed please advise how to resolve the issue Thanks Rao...

  • Can I stop a mailbox rebuild in progress?

    I was having a few glitchy issues with mail and chose "rebuild" from the mailbox menu. Then I find out it's going to redownload everything in my mailbox. My Mac has bogged down to a snails pace. Can I cancel the rebuild? How?