C# d in…“错误?如果是在运行时,我猜,您接收的代码是错误的。如果您在没有联网的情况下尝试上面的示例(使用任何字符串)你会看到它正在工作。也许你想展示你正在做什么?好吧!问题是由于数据量太大而存在的-我无法接收所有数据!你能看看我的编辑并回答这个问题吗?我
C# d in…“错误?如果是在运行时,我猜,您接收的代码是错误的。如果您在没有联网的情况下尝试上面的示例(使用任何字符串)你会看到它正在工作。也许你想展示你正在做什么?好吧!问题是由于数据量太大而存在的-我无法接收所有数据!你能看看我的编辑并回答这个问题吗?我,c#,regex,encryption,C#,Regex,Encryption,d in…“错误?如果是在运行时,我猜,您接收的代码是错误的。如果您在没有联网的情况下尝试上面的示例(使用任何字符串)你会看到它正在工作。也许你想展示你正在做什么?好吧!问题是由于数据量太大而存在的-我无法接收所有数据!你能看看我的编辑并回答这个问题吗?我不确定将来是否能够使用JavaScriptSerializer()发送数据(因为我在“编辑”中描述的问题) string tessst = "abra[s{p(a)c}e]kada[s{p(a)c}e]bra[n|e|w)hel[s{p(a)c
d in…“错误?如果是在运行时,我猜,您接收的代码是错误的。如果您在没有联网的情况下尝试上面的示例(使用任何字符串)你会看到它正在工作。也许你想展示你正在做什么?好吧!问题是由于数据量太大而存在的-我无法接收所有数据!你能看看我的编辑并回答这个问题吗?我不确定将来是否能够使用
JavaScriptSerializer()
发送数据(因为我在“编辑”中描述的问题)
string tessst = "abra[s{p(a)c}e]kada[s{p(a)c}e]bra[n|e|w)hel[s{p(a)c}e]oww[s{p(a)c}e]een";
string tessst = "abra[s{p(a)c}e]kada[s{p(a)c}e]bra[n|e|w)hel[s{p(a)c}e]oww[s{p(a)c}e]een";
List<string[]> splited2 = new List<string[]>();
if (tessst.Length > 0)
{
List<string> splited1 = new List<string>(Regex.Split(tessst, "[^a-zA-Z]+")); //[s{p(a)c}e]
for (int i = 0; i < splited1.Count; i++)
{
splited2.Add(Regex.Split(splited1[i], "[^a-zA-Z]+")); // [n|e|w)
}
}
//splited2 is the result!
List<string[]> result = new List<string[]>();
result.Add(new string[]{"abra", "kada", "bra"});
result.Add(new string[]{"hel", "oww", "een"});
string message = "";
int thisRead = 0;
int max = 10000; // from 1024 to 10000
Byte[] dataByte = new Byte[max];
using (var strm = new MemoryStream())
{
thisRead = Nw.Read(dataByte, 0, max);
strm.Write(dataByte, 0, thisRead);
strm.Seek(0, SeekOrigin.Begin);
using (StreamReader reader = new StreamReader(strm))
{
message = reader.ReadToEnd();
}
}
List<string[]> result = new JavaScriptSerializer().Deserialize<List<string[]>>(message );
List<string[]> list= new List<string[]>();
list = browser_ex.GetMusicListSer(); // 50 list elements
string text_message = new JavaScriptSerializer().Serialize(list);
MemoryStream Fs = new MemoryStream(ASCIIEncoding.Default.GetBytes(text_message));
Byte[] buffer = Fs.ToArray();
Nw.Write(buffer, 0, buffer.Length); // 3499 bytes
using (var writer = new BinaryWriter(networkStream))
{
foreach (var array in list)
{
writer.Write(array.Length);
for (int i = -; i < array.Length; i++)
{
writer.Write(array[i]);
}
}
writer.Write(0);
writer.Flush();
}
using (var reader = new BinaryReader(networkStream))
{
var list = new List<string[]>();
int length;
while ((length = reader.ReadInt32()) != 0)
{
var array = new string[length];
for (int i = 0; i < array.Length; i++)
{
array[i] = reader.ReadString();
}
list.Add(array);
}
}
List<string[]> list = new List<string[]>();
list.Add(new string[] { "abra", "kada", "bra" });
list.Add(new string[] { "hel", "oww", "een" });
string stringToSend = new JavaScriptSerializer().Serialize(list);
//Send
string receivedString = stringToSend;
List<string[]> result = new JavaScriptSerializer()
.Deserialize<List<string[]>>(receivedString);
//Receiver
StreamReader reader = new StreamReader(Nw);
while (true)
{
List<string[]> result = new JavaScriptSerializer()
.Deserialize<List<string[]>>(reader.ReadLine());
//do some work with "result"
}
//Sender
StreamWriter writer = new StreamWriter(Nw);
while (true)
{
//form your "list" and send
writer.WriteLine(new JavaScriptSerializer().Serialize(list));
writer.Flush();
}
string tessst = "abra[s{p(a)c}e]kada[s{p(a)c}e]bra[n|e|w)hel[s{p(a)c}e]oww[s{p(a)c}e]een";
List<string[]> splited2 = new List<string[]>();
if (tessst.Length > 0)
{
List<string> splited1 = new List<string>(Regex.Split(tessst, @"\[n\|e\|w\)"));
for (int i = 0; i < splited1.Count; i++)
{
splited2.Add(Regex.Split(splited1[i], @"\[s\{p\(a\)c\}e\]"));
}
}