PDA

View Full Version : Socket programming



isharasjc
21st March 2012, 04:37
Can anyone tell me how we can handle reading from the socket buffer in an efficient way. Right now I'm just reading sequentially one after the next message and proceed, but it has limitations when it comes to high volume. And this for full time connected socket. I'm thinking of something like parallel reading from the socket buffer using several threads, but I'm not quite sure about this solution. Pls tell me if you guys have a better solution/idea for this.

Thanx in Advance..!

Santosh Reddy
21st March 2012, 06:38
Multiple threads alone is not a solution here, a more effective solution will be use multiple sockets (multiple connections).

Multiple threads with multiple sockets my also be effective, it depends on your application.

isharasjc
21st March 2012, 06:51
Thanx for your reply Santosh.!

I already have the single socket with multi-threaded solution to read from the socket and serve to the requests. But I'm asking this question because that solution has limitations. Coz even it's multi-threaded the reading part from the socket is happening sequentially. For that do you have any solutions to improve the efficiency?

Thanx in Advance.!

wysota
21st March 2012, 08:07
Can anyone tell me how we can handle reading from the socket buffer in an efficient way. Right now I'm just reading sequentially one after the next message and proceed, but it has limitations when it comes to high volume. And this for full time connected socket. I'm thinking of something like parallel reading from the socket buffer using several threads, but I'm not quite sure about this solution. Pls tell me if you guys have a better solution/idea for this.


What volume are we talking about here? Several gigabytes per second?

isharasjc
21st March 2012, 08:57
Thanx wysota.

I'm talking about few Megabytes(like 100 - 200MB) here. Actually I want to read it within few milliseconds or less.

wysota
21st March 2012, 09:03
I'm talking about few Megabytes(like 100 - 200MB) here.
In what time period? 100MB is 800Mb.


Actually I want to read it within few milliseconds or less.
How fast is your NIC? How fast is the link? Is it full duplex or half duplex?

Transfering 800Mb in few miliseconds would require you to have a link of 100Gbps or more, do you have one? Is it some extra new space technology nobody is aware of yet?