Hi,
I've this kind a program, using sockets to communicate with the clients. One
of the clients can be a web browser (like IE).
When using IE as a client, the transmission blocks completely, and IE times
out after a long time while stating opening from http://localhost:7765...
I have a main thread that starts TCPListener and listens and accepts the
connection and queues a worker thread to handle the socket transmission:
loop
..
..
try
{
socket=_mainlis tener.AcceptSoc ket();
ThreadPool.Queu eUserWorkItem(< proc>,socket)
}
catch()
..
..
end loop
The worker thread starts with Receive and then sends a response and loops
over it until the socket is connected:
<init worker thread>
..
..
while(socket.Co nnected)
{
socket.Receive( buf,0,768,0); 1 2161
Some missing details, the connection is TCP, the .NET framework is 1.1Sp1
and OS is Win2kSp4.
Laura
"Laura T." <laura_t@yahood otdotcom> ha scritto nel messaggio
news:O4******** ******@TK2MSFTN GP09.phx.gbl... Hi,
I've this kind a program, using sockets to communicate with the clients. One of the clients can be a web browser (like IE). When using IE as a client, the transmission blocks completely, and IE times out after a long time while stating opening from http://localhost:7765...
I have a main thread that starts TCPListener and listens and accepts the connection and queues a worker thread to handle the socket transmission:
loop . . try { socket=_mainlis tener.AcceptSoc ket(); ThreadPool.Queu eUserWorkItem(< proc>,socket)
} catch() . . end loop
The worker thread starts with Receive and then sends a response and loops over it until the socket is connected:
<init worker thread> . . while(socket.Co nnected) { socket.Receive( buf,0,768,0); . <handle the request> . . socket.Send(<re sponse>); }
socket.Shutdown (); socket.Close();
So I have a main thread listening the main port and spawning socket handler threads thru thread pool. Now, with IE, the worker thread flow goes well, it Receives() and Sends() correctly. Then it goes back to Receive() -> BLOCKED. IE waits and waits and waits. And finally times out. If I comment out the loop so that after the Send i do Shutdown() and Close(), IE is happy. It shows the page. It seems that the Receive() blocks everything, so that IE cannot find out if the data has been sent or cannot read the data, event that Send() says it has sent all.
Am I misusing socket philosophy or is my threading model (passing socket from thread to another) creating problems? Any ideas?
Thanks,
Laura This thread has been closed and replies have been disabled. Please start a new discussion. Similar topics |
by: Sathesh Arumugam |
last post by:
Client is sending data a,b,c using seperate send method to the server
eg.,
Socket.Send('a')
Socket.Send('b')
Socket.Send('c')
In the Server we are using Receive method to receive the incoming data
eg.,
while(true)
{
|
by: chellappa |
last post by:
Hi,
This is program for socket program for server and client ... but data
send from client and receive by server but i can t sen d message fro m
server to client ... check i mistake .. i treed .. its have some
mistake.. if possible correct and send me
server.c
==========
#include <sys/types.h>
#include <sys/socket.h>
|
by: Ricardo Quintanilla |
last post by:
i had a problem whom i do not know how to explain.
i was using a TcpClient (System.Net.Sockets.TcpClient) object to send and
receive data to an AS400 socket. Two months ago it started to work slowly,
about 4 seconds between send and receive. In our production environment with
hundreds of transactions it was truly costly.
a while ago i changed de TcpClient object. Now i am using a Socket
(System.Net.Sockets.Socket) object and it...
|
by: Nuno Magalhaes |
last post by:
I've got a simple problem I guess. How do I know when a connection is
terminated without losing any data?
I do something like the code below, but sometimes between
socket.Receive and socket.Send I get the last chunk of data and am not
able to retrieve it anymore cause the socket will be dead.
Loop:
{
socket.Receive
<----------- data arrives
|
by: DaTurk |
last post by:
I am makeing a Multicast server client setup and was wondering what the
difference is between Socket.Connect, and Socket.Bind.
It may be a stupid question, but I was just curious. Because I tried a
test, and I can't bind two sockets to the same port/ip but I can
connect with one socket, and bind with another to the same ip/port.
Thanks
| |
by: psroga |
last post by:
Can anyone look at this code and let me know why pthread_mutex_unlock
and pthread_mutex_lock are giving me the "phtread_mutex_unlock" was
not defined in this scope error.
I am compiling the code on g++.
# g++ -v
Using built-in specs.
Target: i386-redhat-linux
Configured with: ../configure --prefix=/usr --mandir=/usr/share/man --
infodir=/usr/share/info --enable-shared --enable-threads=posix --
enable-checking=release --with-system-zlib...
|
by: =?Utf-8?B?Y2hyaXNiZW4=?= |
last post by:
Hi,
My understanding is that for the same socket, assuming send and receive run
at two different threads, I have to use BeginReceive to avoid the blocking on
send part. However, I can jsut use Send without worrying about any threading
issue in case send and beginreceive happens at the same time on the socket?
Am I correct on this?
Thanks
|
by: puzzlecracker |
last post by:
Problem:
I send a lot of requests to the application (running on a different
box, of course), and I receive back responses from the app .
Below: socket corresponds to Socket socket=new
Socket(AddressFamily.InterNetwork, SocketType.Stream,
ProtocolType.Tcp);
|
by: EricKit |
last post by:
I'm trying to use socket.send() to send real time images from a camera as fast as possible from a single board computer. I am going over a wireless connection over a mile with almost 1W output power on 802.11.
For many reasons, I have seen the need to find when my file has finished sending, but the socket.send only blocks until it has pushed the file to the buffer. Is there any way to check if the buffer is empty and the file sent?
...
|
by: Hystou |
last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can effortlessly switch the default language on Windows 10 without reinstalling. I'll walk you through it.
First, let's disable language synchronization. With a Microsoft account, language settings sync across devices. To prevent any complications,...
|
by: Hystou |
last post by:
Overview:
Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows Update option using the Control Panel or Settings app; it automatically checks for updates and installs any it finds, whether you like it or not. For most users, this new feature is actually very convenient. If you want to control the update process,...
| |
by: tracyyun |
last post by:
Dear forum friends,
With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each protocol has its own unique characteristics and advantages, but as a user who is planning to build a smart home system, I am a bit confused by the choice of these technologies. I'm particularly interested in Zigbee because I've heard it does some...
|
by: isladogs |
last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM).
In this session, we are pleased to welcome a new presenter, Adolph Dupré who will be discussing some powerful techniques for using class modules.
He will explain when you may want to use classes instead of User Defined Types (UDT). For example, to manage the data in unbound forms.
Adolph will...
|
by: conductexam |
last post by:
I have .net C# application in which I am extracting data from word file and save it in database particularly. To store word all data as it is I am converting the whole word file firstly in HTML and then checking html paragraph one by one.
At the time of converting from word file to html my equations which are in the word document file was convert into image.
Globals.ThisAddIn.Application.ActiveDocument.Select();...
|
by: TSSRALBI |
last post by:
Hello
I'm a network technician in training and I need your help.
I am currently learning how to create and manage the different types of VPNs and I have a question about LAN-to-LAN VPNs.
The last exercise I practiced was to create a LAN-to-LAN VPN between two Pfsense firewalls, by using IPSEC protocols.
I succeeded, with both firewalls in the same network. But I'm wondering if it's possible to do the same thing, with 2 Pfsense firewalls...
|
by: 6302768590 |
last post by:
Hai team
i want code for transfer the data from one system to another through IP address by using C# our system has to for every 5mins then we have to update the data what the data is updated we have to send another system
|
by: muto222 |
last post by:
How can i add a mobile payment intergratation into php mysql website.
| |
by: bsmnconsultancy |
last post by:
In today's digital era, a well-designed website is crucial for businesses looking to succeed. Whether you're a small business owner or a large corporation in Toronto, having a strong online presence can significantly impact your brand's success. BSMN Consultancy, a leader in Website Development in Toronto offers valuable insights into creating effective websites that not only look great but also perform exceptionally well. In this comprehensive...
| |