Transfer file with WCF

Hi,

I need to build a WCF server to receive file from client. But I don’t know how?
can any one give me some instruction or some example?

thx in advance.

.NET MF does not support WCF.

Maybe we meant DPWS. Aren’t these related?

oh, yes, I mean DPWS.
But I need a client on PC, which will have a WCF client.

Do you have any suggestion or sample? will it be slow to use DPWS?

There are examples in my documents folder but I suggest not to use it if you do not have to.

try google

http://social.msdn.microsoft.com/Forums/en-US/wcfprerelease/thread/7510970e-9602-4cb6-baaa-bc1beeaf98df

To Gus:
Thx for your reply, but I can’t find your example.

To Mike:
In fact, I created a DPWS service on board and also a client WCF on PC. I used a HTTP binding. When I transfer file to the device, the speed is super slow. As I need to send a file of 3M, it took more than one hour. Even I set the Oneway property true.
So do you have any suggestion on that?

C:\Users\Gus Issa\Documents\Microsoft .NET Micro Framework 4.1\Samples

Hi Gus:

Sorry for mis-understanding you. But none of the samples is for transferring file. Only a DPWS service. I also followed this sample to build a service on my board. The current problem is that I can’t transfer a file quickly, the speed is terribly slow.

below is my code:
server :


            ProtocolVersion version = new ProtocolVersion10();
            WS2007HttpBinding binding = new WS2007HttpBinding(new HttpTransportBindingConfig(guid, 8084));
            Device.Initialize(binding, version);

//processing file received, I read a file into bytes, and send bytes of 1024 each time



    partial class ChipworkxServiceImplement
    {
        private string _PreviousFileName = "";
        private string _BaseDir;
        private FileStream _FileStream;
        private int _TotalWriteCount = 0;

        public string BaseDir
        {
            set { _BaseDir = value; }
            get { return _BaseDir; }
        }

        public ChipworkxServiceImplement()
        {
            _BaseDir = "\\SD";//"\\ROOT"
        }

        public UploadFileResponse UploadFile(StreamObject req)
        {
            if (_PreviousFileName == null || _PreviousFileName != req.FileName)
            {
                _PreviousFileName = req.FileName;
                if (_FileStream != null)
                {
                    _TotalWriteCount = 0;
                    _FileStream.Close();
                }

                string pathName = Path.Combine(_BaseDir, _PreviousFileName);
                _FileStream = new FileStream(pathName, FileMode.Create);
                _FileStream.Write(req.FileData, 0, req.FileData.Length);
            }
            else if (_PreviousFileName == req.FileName)
            {
                if (req.FileData.Length == 4)
                {
                    byte[] ending = new byte[] {req.FileData[0], req.FileData[1], req.FileData[2], req.FileData[3]};
                    int end = (ending[0] <<  24) | (ending[1] <<  16) | (ending[2] <<  8) | (ending[3]);
                    if ((end & 0xFF) == 0xFF)
                    {
                        _FileStream.Close();
                    }
                }
                else
                {
                    _FileStream.Write(req.FileData, 0, req.FileData.Length);
                }
                
            }

            return new UploadFileResponse(); //
        }
    }

Yes I meant those examples as a starting point. I never used this feature myself.