Click here to Skip to main content
15,920,438 members
Home / Discussions / C#
   

C#

 
GeneralRe: URGENT please - play a .avi file by a file stream Pin
David Stone12-Oct-05 7:20
sitebuilderDavid Stone12-Oct-05 7:20 
GeneralRe: URGENT please - play a .avi file by a file stream Pin
Sasuko12-Oct-05 7:31
Sasuko12-Oct-05 7:31 
GeneralRe: URGENT please - play a .avi file by a file stream Pin
David Stone12-Oct-05 7:48
sitebuilderDavid Stone12-Oct-05 7:48 
GeneralRe: URGENT please - play a .avi file by a file stream Pin
Dave Kreskowiak12-Oct-05 7:59
mveDave Kreskowiak12-Oct-05 7:59 
GeneralRe: URGENT please - play a .avi file by a file stream Pin
Sasuko12-Oct-05 8:19
Sasuko12-Oct-05 8:19 
GeneralRe: URGENT please - play a .avi file by a file stream Pin
Dave Kreskowiak12-Oct-05 11:55
mveDave Kreskowiak12-Oct-05 11:55 
GeneralRe: URGENT please - play a .avi file by a file stream Pin
Sasuko12-Oct-05 11:59
Sasuko12-Oct-05 11:59 
QuestionTCP Synchronous Encryption in C# .NET Pin
IHSSITEMAN12-Oct-05 6:04
IHSSITEMAN12-Oct-05 6:04 
I have been writing a simple client/server application which functions just fine without encryption. However, I need to add encryption to be compliannt with regulations.

I am using RijndaelManaged objects for encryption. Both sender and reciever have the same hard-coded legal Keys and IV's.

Once I have a TCP socket established, I set my Network Stream using tcpClient.GetStream().

I use one of the stream reader/writer classes (all of them fail so far). For example, I will send a sting using a BinaryWriter bWrite. Then I will look to receive some string using BinaryReader bRead.

On the Send Side:

RijndaelManaged crypt = new RijndaelManaged();
//Insert code to set Key and IV
NetworkStream netStream = tcpClient.GetStream();
CryptoStream coutStream = new CryptoStream(netStream,crypt.CreateEncryptor(Key,IV),CryptoStreamMode.Write);
BinaryWriter bWrite = new BinaryWriter(coutStream);
bWrite("Some Cool String");
bWrite.Flush();
coutStream.FlushFinalBlock();

CryptoStream cinStream = new CryptoStream(netStream,crypt.CreateDecryptor(Key,IV),CryptoStreamMode.Read);
BinaryReader bRead = new BinaryReader(cinStream);
String receivedString = bRead.ReadString();

tcpClient.Close();

On the Recieve Side:


RijndaelManaged crypt = new RijndaelManaged();
//Insert code to set Key and IV
NetworkStream netStream = tcpClient.GetStream();


CryptoStream cinStream = new CryptoStream(netStream,crypt.CreateDecryptor(Key,IV),CryptoStreamMode.Read);
BinaryReader bRead = new BinaryReader(cinStream);
String receivedString = bRead.ReadString();

CryptoStream coutStream = new CryptoStream(netStream,crypt.CreateEncryptor(Key,IV),CryptoStreamMode.Write);
BinaryWriter bWrite = new BinaryWriter(coutStream);
bWrite("Some Cool String");
bWrite.Flush();
coutStream.FlushFinalBlock();
tcpClient.Close();


PROBLEM:

If I simply send from one program and recieve on the other -- everything works fine. It is when I actually send/receive from both that the program hangs.

Any thoughts?


-- modified at 12:09 Wednesday 12th October, 2005
AnswerRe: TCP Synchronous Encryption in C# .NET Pin
David Stone12-Oct-05 6:49
sitebuilderDavid Stone12-Oct-05 6:49 
GeneralRe: TCP Synchronous Encryption in C# .NET Pin
IHSSITEMAN12-Oct-05 7:51
IHSSITEMAN12-Oct-05 7:51 
QuestionRunning Word Macros from an external file using Automation Pin
Guinness4Strength12-Oct-05 5:23
Guinness4Strength12-Oct-05 5:23 
QuestionAdd a List to a Console Application Pin
kmg4312-Oct-05 5:01
kmg4312-Oct-05 5:01 
AnswerRe: Add a List to a Console Application Pin
Dave Kreskowiak12-Oct-05 5:12
mveDave Kreskowiak12-Oct-05 5:12 
QuestionHow to Scan Bar Code in C# Pin
| Muhammad Waqas Butt |12-Oct-05 4:22
professional| Muhammad Waqas Butt |12-Oct-05 4:22 
AnswerRe: How to Scan Bar Code in C# Pin
Dave Kreskowiak12-Oct-05 4:38
mveDave Kreskowiak12-Oct-05 4:38 
GeneralRe: How to Scan Bar Code in C# Pin
| Muhammad Waqas Butt |12-Oct-05 22:32
professional| Muhammad Waqas Butt |12-Oct-05 22:32 
GeneralRe: How to Scan Bar Code in C# Pin
Anonymous13-Oct-05 2:49
Anonymous13-Oct-05 2:49 
GeneralRe: How to Scan Bar Code in C# Pin
| Muhammad Waqas Butt |13-Oct-05 22:26
professional| Muhammad Waqas Butt |13-Oct-05 22:26 
Questiondatagrid dynamic data & formating Pin
12-Oct-05 4:17
suss12-Oct-05 4:17 
Questionhow to write / read image data to /from xml file Pin
Member 78161012-Oct-05 3:29
Member 78161012-Oct-05 3:29 
AnswerRe: how to write / read image data to /from xml file Pin
leppie12-Oct-05 4:19
leppie12-Oct-05 4:19 
QuestionLutz Roeder's .NET Reflector Pin
zaboboa12-Oct-05 1:58
zaboboa12-Oct-05 1:58 
AnswerRe: Lutz Roeder's .NET Reflector Pin
mav.northwind12-Oct-05 2:34
mav.northwind12-Oct-05 2:34 
GeneralRe: Lutz Roeder's .NET Reflector Pin
zaboboa12-Oct-05 3:10
zaboboa12-Oct-05 3:10 
GeneralRe: Lutz Roeder's .NET Reflector Pin
Dave Kreskowiak12-Oct-05 4:28
mveDave Kreskowiak12-Oct-05 4:28 

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.