Archived

This forum has been archived. Please start a new discussion on GitHub.

Newbie question about sending data

Good day, all!

I have one newbie question.
There is a task - to send a file (for example, any file in binary mode) from client to server.

How it can be done?
From where I must start to work?
What section of documentation can help me to solve this task?

Thanks a lot.
Alexander

Comments

  • mes
    mes California
    Hi,

    Ice includes a service called IcePatch2 that allows you to efficiently replicate a directory hierarchy across a network. I recommend that you study the IcePatch2 sources (in src/IcePatch2) for a good example of how to efficiently transfer large amounts of data using Ice.

    Take care,
    - Mark
  • If i understood, IcePatch2 is using for sending data from server to client.
    But in my case a one binary file from client to server must be sent.
    How it can be realize?
  • mes
    mes California
    You are correct that IcePatch2 transfers files from the server to a client, but the technique it uses to transfer the file is applicable regardless of the direction in which the file is sent.

    Take care,
    - Mark
  • Oh, ok. I will teach it tomorrow.

    And my search in forum archive gave me next links:
    http://www.zeroc.com/vbulletin/showthread.php?t=292

    What is better to use: sequence or IcePatch2? (i don't want to reinventing a wheel)
  • mes
    mes California
    IcePatch2 probably isn't an appropriate solution if you are sending files from a client to a server. However, reading the IcePatch2 sources should be helpful as you implement your application.

    Good luck,
    - Mark
  • Ok, i will look it.
    Thanks you, mes, for you answer.
  • I have one new question: can I call a function which realized on client without using some server part on a client side?

    In detail: client call thrue proxy a function on server and give for him a proxy to function (ClientFunc* func) in parameter. After that server must call received function on client. Еhere is no need to use asynchronous working.

    How it can be done?
  • mes
    mes California
    Yes, you can do this. The callback example in demo/Ice/callback demonstrates how to do this. Note that this example requires that the server establish a new connection back to the client. An alternative is to use a bidirectional connection, which is shown by the example in demo/Ice/bidir.

    Good luck,
    - Mark
  • Thanks, I must keep my eyes more openly.

    Is every callback function must have void declaration?
  • mes
    mes California
    AlexKom wrote:
    Is every callback function must have void declaration?
    No, you can use any declaration you like if your callback is invoked as a twoway. However, if you want to invoke the callback as a oneway, then it must have a void return type and it must not have any out parameters.

    - Mark
  • Ok, thats work excelent. I get a callback example and modify it a little. I get what i want.

    Thanks a lot for your help, Mark!