Click here to Skip to main content
15,886,110 members
Home / Discussions / C#
   

C#

 
GeneralWSE 2.0 and Encryption Pin
Bill Dean4-Jan-05 14:48
Bill Dean4-Jan-05 14:48 
GeneralRe: WSE 2.0 and Encryption Pin
Heath Stewart4-Jan-05 20:31
protectorHeath Stewart4-Jan-05 20:31 
GeneralRe: WSE 2.0 and Encryption Pin
Bill Dean5-Jan-05 3:26
Bill Dean5-Jan-05 3:26 
GeneralRe: WSE 2.0 and Encryption Pin
Heath Stewart5-Jan-05 7:09
protectorHeath Stewart5-Jan-05 7:09 
GeneralRe: WSE 2.0 and Encryption Pin
Bill Dean5-Jan-05 9:35
Bill Dean5-Jan-05 9:35 
GeneralRe: WSE 2.0 and Encryption Pin
Heath Stewart5-Jan-05 14:51
protectorHeath Stewart5-Jan-05 14:51 
GeneralRe: WSE 2.0 and Encryption Pin
Bill Dean6-Jan-05 4:36
Bill Dean6-Jan-05 4:36 
GeneralSocket receiving too slowly Pin
tantiboh4-Jan-05 13:51
tantiboh4-Jan-05 13:51 
I'm not a new programmer, but this one's got me stymied; hopefully it's a fairly trivial problem.

I'm using a socket connection to receive communication from a server. Normally, the entire message is received before the program moves on with its next instructions. However, at times when the processor is particularly busy the program seems to progress with its instructions without having received the entire communication. In other words, it seems to clean out the buffer, which due to the computer's business is holding only the first packet at this point, then move on without waiting for the buffer to fill with the next packet.

Is there a way to stop the program until it has been told that the entire communication has been received? Or a way to iteratively receive the packets until the program is told the communication is finished?

Here's my code:

<br />
IPHostEntry IPAdd = Dns.Resolve("servername.com");<br />
//Configure the socket<br />
IPEndPoint IPEP = new IPEndPoint(IPAdd.AddressList[0], 2628);<br />
Socket s = new Socket(IPEP.Address.AddressFamily, SocketType.Stream, ProtocolType.Tcp);<br />
//Construct the message<br />
string str = "Message"<br />
//Declare the receive buffer. Maximum of 50,000 characters.<br />
Byte[] Receiver = new Byte[50000];<br />
//Connect the socket<br />
s.Connect(IPEP);<br />
//Receive greeting. Is discarded.<br />
Int32 bytes = s.Receive(Receiver, Receiver.Length, 0);<br />
//Declare the send buffer. Initialize it with the query, converted into bytes.<br />
Byte[] Sender = System.Text.Encoding.ASCII.GetBytes(str);<br />
//Send the query.<br />
s.Send(Sender, Sender.Length, 0);<br />
//Receive the response into the byte array <br />
bytes = s.Receive(Receiver, Receiver.Length, 0);<br />
//Translate the byte array into ASCII text<br />
strResponse = System.Text.Encoding.ASCII.GetString(Receiver, 0, bytes);<br />


...Furthur code

Thanks for your help!
GeneralRe: Socket receiving too slowly Pin
Heath Stewart4-Jan-05 20:17
protectorHeath Stewart4-Jan-05 20:17 
GeneralRe: Socket receiving too slowly Pin
tantiboh5-Jan-05 18:52
tantiboh5-Jan-05 18:52 
GeneralXmodem implimentation Pin
therealmccoy4-Jan-05 12:35
therealmccoy4-Jan-05 12:35 
GeneralRe: Xmodem implimentation Pin
Heath Stewart4-Jan-05 13:37
protectorHeath Stewart4-Jan-05 13:37 
GeneralRe: Xmodem implimentation Pin
therealmccoy4-Jan-05 14:29
therealmccoy4-Jan-05 14:29 
GeneralRe: Xmodem implimentation Pin
Heath Stewart4-Jan-05 20:12
protectorHeath Stewart4-Jan-05 20:12 
GeneralString output in C# from a C++ dll Pin
vinayakdl4-Jan-05 12:29
vinayakdl4-Jan-05 12:29 
GeneralRe: String output in C# from a C++ dll Pin
Heath Stewart4-Jan-05 13:34
protectorHeath Stewart4-Jan-05 13:34 
GeneralRe: String output in C# from a C++ dll Pin
vinayakdl5-Jan-05 4:53
vinayakdl5-Jan-05 4:53 
GeneralRe: String output in C# from a C++ dll Pin
Heath Stewart5-Jan-05 7:04
protectorHeath Stewart5-Jan-05 7:04 
GeneralRe: String output in C# from a C++ dll Pin
vinayakdl6-Jan-05 9:55
vinayakdl6-Jan-05 9:55 
GeneralRe: String output in C# from a C++ dll Pin
Heath Stewart6-Jan-05 12:04
protectorHeath Stewart6-Jan-05 12:04 
GeneralHELP! Web secuirty ... Pin
mrwonkothesane424-Jan-05 11:38
mrwonkothesane424-Jan-05 11:38 
GeneralReplacing text Pin
Christer Claesson4-Jan-05 11:35
Christer Claesson4-Jan-05 11:35 
GeneralSpecial Keyboard keys Pin
BertGo4-Jan-05 10:25
BertGo4-Jan-05 10:25 
GeneralRe: Special Keyboard keys Pin
Heath Stewart4-Jan-05 11:12
protectorHeath Stewart4-Jan-05 11:12 
GeneralRe: Special Keyboard keys Pin
BertGo4-Jan-05 13:00
BertGo4-Jan-05 13:00 

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.