Click here to Skip to main content
15,897,371 members
Home / Discussions / C#
   

C#

 
QuestionThread end Pin
yesu prakash15-Apr-09 18:43
yesu prakash15-Apr-09 18:43 
AnswerRe: Thread end Pin
N a v a n e e t h15-Apr-09 19:04
N a v a n e e t h15-Apr-09 19:04 
AnswerRe: Thread end Pin
Vikram A Punathambekar15-Apr-09 19:08
Vikram A Punathambekar15-Apr-09 19:08 
AnswerRe: Thread end Pin
Fayu16-Apr-09 2:38
Fayu16-Apr-09 2:38 
QuestionSet User for SQL Server and Windows App Pin
BhavinBhatt15-Apr-09 18:40
BhavinBhatt15-Apr-09 18:40 
AnswerRe: Set User for SQL Server and Windows App Pin
Henry Minute15-Apr-09 23:51
Henry Minute15-Apr-09 23:51 
QuestionADO.NET nested transaction [modified] Pin
devvvy15-Apr-09 18:31
devvvy15-Apr-09 18:31 
QuestionAbout wireless data transfer Pin
Xmen Real 15-Apr-09 18:25
professional Xmen Real 15-Apr-09 18:25 
I'm developing a Wireless Data Transfer(WDT) applications(server and client). The server will work in pda thats why using CF and the client app will work in pc using DNF. I've already developed this type of server for PC to PC WDT and used this code to receive the data. Written in Tick event of Timer.

if (clientSocket != null && clientSocket.Connected)
{
    try
    {
        timer1.Enabled = false;

        List<byte> data = new List<byte>();
        int dataLength = 0;

        if (clientSocket.Available > 0)
        {
            byte[] buffer = new byte[4];
            if (clientSocket.Available < buffer.Length)
            {
                LogText("Error : Inappropriate data received.");
                return;
            }
            int read = clientSocket.Receive(buffer, SocketFlags.None);
            if (read != buffer.Length)
            {
                LogText("Error : Unable to start reading.");
                return;
            }
            //XConverter.GetInt32(buffer); // avoiding this in CF
            BinaryReader br = new BinaryReader(new MemoryStream(buffer));
            dataLength = br.ReadInt32(); // Original Length
            br.Close();
            data.AddRange(buffer);
        }

        while (data.Count != dataLength)
        {
            while (clientSocket.Available > 0)
            {
                byte[] buffer = new byte[clientSocket.Available];
                int read = clientSocket.Receive(buffer, SocketFlags.None);
                for (int a = 0; a < read; a++)
                    data.Add(buffer[a]);
                Send(InstructionType.SendFileProgress, (data.Count * 100) / dataLength); // sending file progress to uploader
            }
        }
        if (data.Count != 0)
            ProcessReceivedData(data.ToArray());
    }
    catch (Exception ex)
    { LogText("Error while receiving data...\r\n" + ex.Message); }
    finally { timer1.Enabled = true; }
}</byte></byte>


All works good in PC to PC as well as PC to PDA, but as you can see I'm filling all the bytes directly to the memory(List<byte>) and I'm sure that gonna hurt the pda performance if the file size is big. e.g let assume pda process memory is 21 mb and if I'm sending a file more than 21 than pda wont response or raise out of memory exception(No idea what will happen). What I want is to directly write it to the specified place(ie. Memory card) and no effect to pda working memory. I thought to use TCPListener and TCPClient but I'm not sure that they will take over the Socket place as I used it everywhere in Client and Server. Since I never use TCP so may be TCP is better than Socket.

My question is that is there any way in Socket to that what I want or I should use TCP or any better idea ?

Thanks



TVMU^P[[IGIOQHG^JSH`A#@`RFJ\c^JPL>;"[,*/|+&WLEZGc`AFXc!L
%^]*IRXD#@GKCQ`R\^SF_WcHbORY87֦ʻ6ϣN8ȤBcRAV\Z^&SU~%CSWQ@#2
W_AD`EPABIKRDFVS)EVLQK)JKQUFK[M`UKs*$GwU#QDXBER@CBN%
R0~53%eYrd8mt^7Z6]iTF+(EWfJ9zaK-i’TV.C\y<pŠjxsg-b$f4ia>

-----------------------------------------------
128 bit encrypted signature, crack if you can

QuestionDirectory Stream Pin
biggy115-Apr-09 13:31
biggy115-Apr-09 13:31 
AnswerRe: Directory Stream Pin
harold aptroot15-Apr-09 13:37
harold aptroot15-Apr-09 13:37 
GeneralRe: Directory Stream Pin
biggy115-Apr-09 13:51
biggy115-Apr-09 13:51 
GeneralRe: Directory Stream Pin
harold aptroot15-Apr-09 14:01
harold aptroot15-Apr-09 14:01 
GeneralRe: Directory Stream Pin
biggy115-Apr-09 14:12
biggy115-Apr-09 14:12 
GeneralRe: Directory Stream Pin
harold aptroot15-Apr-09 14:43
harold aptroot15-Apr-09 14:43 
GeneralRe: Directory Stream [modified] Pin
biggy115-Apr-09 15:00
biggy115-Apr-09 15:00 
GeneralRe: Directory Stream Pin
harold aptroot16-Apr-09 1:36
harold aptroot16-Apr-09 1:36 
GeneralRe: Directory Stream Pin
biggy116-Apr-09 10:21
biggy116-Apr-09 10:21 
AnswerRe: Directory Stream Pin
Xmen Real 15-Apr-09 18:39
professional Xmen Real 15-Apr-09 18:39 
QuestionWatching for Removeable Drives Pin
Jammer15-Apr-09 12:20
Jammer15-Apr-09 12:20 
AnswerRe: Watching for Removeable Drives Pin
Luc Pattyn15-Apr-09 12:42
sitebuilderLuc Pattyn15-Apr-09 12:42 
AnswerRe: Watching for Removeable Drives Pin
Nilesh Hapse15-Apr-09 20:16
Nilesh Hapse15-Apr-09 20:16 
QuestionSocket Connection Shutdown and Close Pin
kikeman15-Apr-09 11:41
kikeman15-Apr-09 11:41 
AnswerRe: Socket Connection Shutdown and Close Pin
Colin Angus Mackay15-Apr-09 12:12
Colin Angus Mackay15-Apr-09 12:12 
GeneralRe: Socket Connection Shutdown and Close Pin
kikeman16-Apr-09 4:45
kikeman16-Apr-09 4:45 
GeneralRe: Socket Connection Shutdown and Close Pin
Colin Angus Mackay16-Apr-09 5:05
Colin Angus Mackay16-Apr-09 5:05 

General General    News News    Suggestion Suggestion    Question Question    Bug Bug    Answer Answer    Joke Joke    Praise Praise    Rant Rant    Admin Admin   

Use Ctrl+Left/Right to switch messages, Ctrl+Up/Down to switch threads, Ctrl+Shift+Left/Right to switch pages.