Reputation: 1519
I have a huge problem. I write small servers in C#. My clients are JavaScript. JavaScript use HTTP GET to communicate because JavaScript must pass Same Origin Policy. It means I must use HTTP GET to comunication. Now I notice that C# cut (??) my URL.
I sended:
http://172.16.210.25:8000/?callback=ProxyApi.saveStat&cid=1343823765156_495&cidget=null&s[901]=1044!:!5878849%3B6658291%3B2964823%3B1178767%3B469747%3B481939%3B6431323%3B1032649%3B2750603%3B208057%3B9192763%3B6669071%3B2014351%3B6816157%3B3784367%3B1242929%3B4488073%3B7662331%3B2991731%3B6404357%3B8248091%3B1795603%3B4880191%3B3080303%3B4093847%3B4618063%3B7501937%3B2842849%3B6953249%3B7102679%3B5667853%3B9851873%3B5517823%3B6114539%3B6061597%3B7647599%3B4871873%3B400087%3B7514713%3B3958217%3B8163713%3B9560437%3B8229701%3B3408749%3B4432097%3B3353219%3B2936693%3B1343597%3B3490451%3B1266191%3B9125747%3B6152921%3B2689537%3B3796861%3B4987009%3B1206841%3B9278119%3B9499619%3B455627%3B6217051%3B7603201%3B8019079%3B5306033%3B8314939%3B2997221%3B3996221%3B3889649%3B1148507%3B9397139%3B4984949%3B6576473%3B3993247%3B676051%3B5%3B&s[902]=929!:!9012569%3B9836633%3B5239051%3B6102559%3B5944079%3B9749681%3B4007797%3B344821%3B9914917%3B1950227%3B982847%3B6610337%3B6734281%3B4213463%3B1620449%3B1745111%3B8005717%3B6740443%3B8290811%3B9652289%3B279557%3B9077213%3B169933%3B4785463%3B368521%3B5881487%3B5735711%3B189377%3B3417091%3B8616299%3B7168723%3B4220969%3B4493651%3B5067977%3B1646387%3B3925297%3B5990723%3B6826471%3B3040753%3B1449733%3B8905681%3B2502001%3B7304107%3B1022677%3B4966529%3B8679397%3B4319519%3B3991279%3B1128641%3B2148631%3B2215987%3B1135217%3B3846281%3B1049843%3B309937%3B2241691%3B8768581%3B6199693%3B7973921%3B9683627%3B9664957%3B4493023%3B2494729%3B3581167%3B8474597%3B1987919%3B6099271%3B&t=68999&pxid=142221422
But I got in string:
?callback=ProxyApi.saveStat&cid=1343823765156_495&cidget=null&s[901]=1044!:!5878849%3B6658291%3B2964823%3B1178767%3B469747%3B481939%3B6431323%3B1032649%3B2750603%3B208057%3B9192763%3B6669071%3B2014351%3B6816157%3B3784367%3B1242929%3B4488073%3B7662331%3B2991731%3B6404357%3B8248091%3B1795603%3B4880191%3B3080303%3B4093847%3B4618063%3B7501937%3B2842849%3B6953249%3B7102679%3B5667853%3B9851873%3B5517823%3B6114539%3B6061597%3B7647599%3B4871873%3B400087%3B7514713%3B3958217%3B8163713%3B9560437%3B8229701%3B3408749%3B4432097%3B3353219%3B2936693%3B1343597%3B3490451%3B1266191%3B9125747%3B6152921%3B2689537%3B3796861%3B4987009%3B1206841%3B9278119%3B9499619%3B455627%3B6217051%3B7603201%3B8019079%3B5306033%3B8314939%3B2997221%3B3996221%3B3889649%3B1148507%3B9397139%3B4984949%3B6576473%3B3993247%3B676051%3B5%3B&s[902]=929!:!9012569%3B9836633%3B5239051%3B6102559%3B5944079%3B9749681%3B4007797%3B344821%3B9914917%3B1950227%3B982847%3B6610337%3B6734281%3B4213463%3B1620449%3B1745111%3B8005717%3B6740443%3B8290811%3B9652289%3B279
I lost some important data.
Im listing using:
IPAddress local_ip = Dns.GetHostAddresses(Dns.GetHostName())[0];
TcpListener sockServer = new TcpListener(local_ip,Port);
sockServer.Start();
And
ThreadPool.QueueUserWorkItem(new WaitCallback(ThreadFunction), sockServer.AcceptSocket());
And inside ThreadFunction I have
static void ThreadFunction(Object param)
{
Socket socket = (Socket)param;
proxy.Run(socket);
}
Finally I read message using this:
int bytes = ReadMessage(socket, readBuf, ref strFromClient);
Can you help me pass problem with URL LENGHT or change method of listining (unknown Javscript clients send large messeage using HTTP GET.)
=================== EDIT
I try using IE, Chrome and FF. I sent
http://172.16.210.25:8000/?callback=ProxyApi.saveStat&cid=1343823765156_495&cidget=null&s[901]=1044!:!5878849%3B6658291%3B2964823%3B1178767%3B469747%3B481939%3B6431323%3B1032649%3B2750603%3B208057%3B9192763%3B6669071%3B2014351%3B6816157%3B3784367%3B1242929%3B4488073%3B7662331%3B2991731%3B6404357%3B8248091%3B1795603%3B4880191%3B3080303%3B4093847%3B4618063%3B7501937%3B2842849%3B6953249%3B7102679%3B5667853%3B9851873%3B5517823%3B6114539%3B6061597%3B7647599%3B4871873%3B400087%3B7514713%3B3958217%3B8163713%3B9560437%3B8229701%3B3408749%3B4432097%3B3353219%3B2936693%3B1343597%3B3490451%3B1266191%3B9125747%3B6152921%3B2689537%3B3796861%3B4987009%3B1206841%3B9278119%3B9499619%3B455627%3B6217051%3B7603201%3B8019079%3B5306033%3B8314939%3B2997221%3B3996221%3B3889649%3B1148507%3B9397139%3B4984949%3B6576473%3B3993247%3B676051%3B5%3B&s[902]=929!:!9012569%3B9836633%3B5239051%3B6102559%3B5944079%3B9749681%3B4007797%3B344821%3B9914917%3B1950227%3B982847%3B6610337%3B6734281%3B4213463%3B1620449%3B1745111%3B8005717%3B6740443%3B8290811%3B9652289%3B279557%3B9077213%3B169933%3B4785463%3B368521%3B5881487%3B5735711%3B189377%3B3417091%3B8616299%3B7168723%3B4220969%3B4493651%3B5067977%3B1646387%3B3925297%3B5990723%3B6826471%3B3040753%3B1449733%3B8905681%3B2502001%3B7304107%3B1022677%3B4966529%3B8679397%3B4319519%3B3991279%3B1128641%3B2148631%3B2215987%3B1135217%3B3846281%3B1049843%3B309937%3B2241691%3B8768581%3B6199693%3B7973921%3B9683627%3B9664957%3B4493023%3B2494729%3B3581167%3B8474597%3B1987919%3B6099271%3B&t=68999&pxid=142221422
But I always get
GET /?callback=ProxyApi.saveStat&cid=1343823765156_495&cidget=null&s[901]=1044!:!5878849%3B6658291%3B2964823%3B1178767%3B469747%3B481939%3B6431323%3B1032649%3B2750603%3B208057%3B9192763%3B6669071%3B2014351%3B6816157%3B3784367%3B1242929%3B4488073%3B7662331%3B2991731%3B6404357%3B8248091%3B1795603%3B4880191%3B3080303%3B4093847%3B4618063%3B7501937%3B2842849%3B6953249%3B7102679%3B5667853%3B9851873%3B5517823%3B6114539%3B6061597%3B7647599%3B4871873%3B400087%3B7514713%3B3958217%3B8163713%3B9560437%3B8229701%3B3408749%3B4432097%3B3353219%3B2936693%3B1343597%3B3490451%3B1266191%3B9125747%3B6152921%3B2689537%3B3796861%3B4987009%3B1206841%3B9278119%3B9499619%3B455627%3B6217051%3B7603201%3B8019079%3B5306033%3B8314939%3B2997221%3B3996221%3B3889649%3B1148507%3B9397139%3B4984949%3B6576473%3B3993247%3B676051%3B5%3B&s[902]=929!:!9012569%3B9836633%3B5239051%3B6102559%3B5944079%3B9749681%3B4007797%3B344821%3B9914917%3B1950227%3B982847%3B6610337%3B6734281%3B4213463%3B1620449%3B1745111%3B8005717%3B6740443%3B8290811%3B9652289%3B279
Look
private Byte[] readBuf = new Byte[2048];
int bytes = ReadMessage(socket, readBuf, ref strFromClient);
My bytes always are to 1024. Where can be limits of there?
Upvotes: 1
Views: 6471
Reputation: 1519
I was careless. Function ReadMessage is function from own class. And it wrote:
sock.Receive(buf, 1024, 0);
Of course I fix:
sock.Receive(buf,buf.Length,0);
And Now it runs. Thank for your answers.
Upvotes: 0
Reputation: 25619
HTTP GET requests are usually limited to ~2000 characters (client-wise, that is)
Here's a reference from MS
GET is not intended for sending large amount of data, that's why it's called GET... try to provide more information regarding your client and we might be able to offer you an alternative
Upvotes: 4