Click here to Skip to main content
15,922,533 members
Home / Discussions / C#
   

C#

 
GeneralRe: problem Pin
NormDroid23-May-05 22:08
professionalNormDroid23-May-05 22:08 
GeneralRe: problem Pin
send2naeem23-May-05 22:10
send2naeem23-May-05 22:10 
GeneralRe: problem Pin
User 665823-May-05 22:41
User 665823-May-05 22:41 
GeneralRe: problem Pin
send2naeem23-May-05 23:23
send2naeem23-May-05 23:23 
GeneralRe: problem Pin
J4amieC23-May-05 23:40
J4amieC23-May-05 23:40 
Generalto send live video & audio (streams) on network. Pin
shumyla198323-May-05 21:24
shumyla198323-May-05 21:24 
GeneralC string reading Pin
saberhawkp423-May-05 20:02
saberhawkp423-May-05 20:02 
GeneralEncoding Technique Pin
Rashaida23-May-05 19:53
sussRashaida23-May-05 19:53 
How can i transfer same format?
i send file on network but on client side not recieved same format.
i used Myobj class

[Serializable]
public class MyObject
{
public int size;
public byte[] buffer=null;
public string str="hello string";

public MyObject()
{

}
Server send data on network as


public void senddata(string fname)
{


MyObject obj=new MyObject();
//Create a file stream from an existing file.
FileInfo fi=new FileInfo(fname);
FileStream fs=fi.OpenRead();
//Read 100 bytes into an array from the specified file.
// int nBytes;
byte[] ByteArray=new byte[(int)fs.Length];
obj.size=(int)fs.Length;
obj.buffer=ByteArray;
IFormatter formatter = new BinaryFormatter();
formatter.Serialize(st.BaseStream, obj);
st.BaseStream.Flush();

}


& on client side receieved data as


public void receivedata()
{
MyObject obj=new MyObject();
IFormatter formatter = new BinaryFormatter();
obj =(MyObject)formatter.Deserialize(at.BaseStream);
Encoding ascii = Encoding.ASCII;
Encoding unicode = Encoding.Unicode;



byte[] ByteArray=new byte[obj.size];
byte[] asciiBytes = Encoding.Convert(ascii, unicode, obj.buffer);

// at.BaseStream.Read(ByteArray, 0, 11);
FileStream fs1=File.Create("c:\\clock1.avi");
fs1.Write(obj.buffer,0,obj.size);
fs1.Close();
ptr(obj.size.ToString());
ptr(obj.str);


}

kindly tell default encoding technique or any other solution
from which we receieve same format on server & client side

Rashaida
GeneralReading Access Schema Pin
ivix4u23-May-05 18:13
ivix4u23-May-05 18:13 
GeneralRemoving HTML-tags from a string Pin
anderslundsgard23-May-05 18:08
anderslundsgard23-May-05 18:08 
GeneralRe: Removing HTML-tags from a string Pin
Serdar YILMAZ23-May-05 21:27
Serdar YILMAZ23-May-05 21:27 
GeneralRe: Removing HTML-tags from a string Pin
anderslundsgard23-May-05 22:27
anderslundsgard23-May-05 22:27 
GeneralRe: Removing HTML-tags from a string Pin
eggie524-May-05 12:53
eggie524-May-05 12:53 
Questionlgo4net not found...? Reference: Copy Local solved the problem...? Pin
devvvy23-May-05 17:53
devvvy23-May-05 17:53 
GeneralTell me Default Encoding technique Pin
shumyla198323-May-05 17:02
shumyla198323-May-05 17:02 
GeneralString of Bits to Byte[ ] Conversion Pin
gordsh23-May-05 15:59
gordsh23-May-05 15:59 
GeneralRe: String of Bits to Byte[ ] Conversion Pin
S. Senthil Kumar23-May-05 18:11
S. Senthil Kumar23-May-05 18:11 
GeneralRe: String of Bits to Byte[ ] Conversion Pin
Robert Rohde23-May-05 20:33
Robert Rohde23-May-05 20:33 
GeneralRe: String of Bits to Byte[ ] Conversion Pin
gordsh24-May-05 15:51
gordsh24-May-05 15:51 
GeneralShow hidden forms Pin
methodincharge23-May-05 13:30
methodincharge23-May-05 13:30 
GeneralRe: Show hidden forms Pin
Rob Tomson23-May-05 13:42
Rob Tomson23-May-05 13:42 
GeneralRe: Show hidden forms Pin
methodincharge23-May-05 13:56
methodincharge23-May-05 13:56 
GeneralRe: Show hidden forms Pin
Skynyrd24-May-05 6:55
Skynyrd24-May-05 6:55 
GeneralRe: Show hidden forms Pin
methodincharge24-May-05 7:38
methodincharge24-May-05 7:38 
GeneralRe: Show hidden forms Pin
Skynyrd24-May-05 21:41
Skynyrd24-May-05 21:41 

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.