Sponsored Content
Top Forums Programming socket function to read a webpage (socket.h) Post 302409451 by achenle on Thursday 1st of April 2010 08:03:56 AM
Old 04-01-2010
Because you just read the contents of the first TCP packet that you received.

Basically, you need to keep reading from the socket until you get nothing more back. If the server you connect to closes the connection, that's easy to find. If not, you have to figure out how you're going to define when the server is done sending data.
 

10 More Discussions You Might Find Interesting

1. Shell Programming and Scripting

send function in socket

Hi All, I encountered a stange problem while doing a perl script to use socket. i need to transfer a file from client to sever. but error came as argument missing in send function.........Plz tell me the wt r the arguments in send and recv functions....... (0 Replies)
Discussion started by: trupti_rinku
0 Replies

2. Programming

Anyone know how to use socket select() function?

hello socket programming expert, I having difficulties in understanding how select() function in socket programming work.... I'm trying to create my own peer-to-peer chat or file transfer program by using the select() function.... Therefore does anyone had any tutorial or source code that... (4 Replies)
Discussion started by: draggy
4 Replies

3. Programming

connect() function in C++ socket programming

Hello All, I have a problem using connect(...) function in C++. I am using SSH from my windows system to connect it to linux server. The program works fine if I run it directly in Linux machine but I need it to run through windows machine. The function returns -1 and so my program terminates. ... (3 Replies)
Discussion started by: smdhd3
3 Replies

4. Programming

Please help! accept function problems in Socket programming

Hi, I have a client-server socket program. It has been working fine for over a year, but recently it started to show strange behavior.:confused: After the server program runs for a while, it will show in the top command saying it is using lots of CPU, MEM. I assume it means the server code is... (1 Reply)
Discussion started by: natxie
1 Replies

5. UNIX for Advanced & Expert Users

connect problem for sctp socket (ipv6 socket) - Runtime fail Invalid Arguments

Hi, I was porting ipv4 application to ipv6; i was done with TCP transports. Now i am facing problem with SCTp transport at runtime. To test SCTP transport I am using following server and client socket programs. Server program runs fine, but client program fails giving Invalid Arguments for... (0 Replies)
Discussion started by: chandrutiptur
0 Replies

6. Programming

which socket should socket option on be set

Hi all, On the server side, one socket is used for listening, the others are used for communicating with the client. My question is: if i want to set option for socket, which socket should be set on? If either can be set, what's the different? Again, what's the different if set option... (1 Reply)
Discussion started by: blademan100
1 Replies

7. Programming

Error with socket operation on non-socket

Dear Experts, i am compiling my code in suse 4.1 which is compiling fine, but at runtime it is showing me for socket programming error no 88 as i searched in errno.h it is telling me socket operation on non socket, what is the meaning of this , how to deal with this error , please... (1 Reply)
Discussion started by: vin_pll
1 Replies

8. IP Networking

Clarification - Setting socket options at the same time when socket is listening

I need clarification on whether it is okay to set socket options on a listening socket simultaneously when it is being used in an accept() call? Following is the scenario:- -- Task 1 - is executing in a loop - polling a listen socket, lets call it 'fd', (whose file descriptor is global)... (2 Replies)
Discussion started by: jake24
2 Replies

9. Shell Programming and Scripting

Read and write to tcp socket

Hello all, I have a requirement to read and write to a tcp socket from an HP-UX shell script. I see a /dev/tcp character device on my servers: crw-rw-rw- 1 root root 72 0x00004f Mar 28 18:37 /dev/tcp So I believe this is what I should use. The problem is that all the... (2 Replies)
Discussion started by: lupin..the..3rd
2 Replies

10. Programming

read from socket

hello I have a C program and I want to read data from a socket ,and especially I want a client to send a .jpg to the server.The problem I face is that no matter what the size of the photo is,my read command seems to read an amount of data and then does nothing. while(1){ ... (4 Replies)
Discussion started by: vlm
4 Replies
STREAM_SOCKET_SENDTO(3) 						 1						   STREAM_SOCKET_SENDTO(3)

stream_socket_sendto - Sends a message to a socket, whether it is connected or not

SYNOPSIS
int stream_socket_sendto (resource $socket, string $data, [int $flags], [string $address]) DESCRIPTION
Sends the specified $data through the $socket. PARAMETERS
o $socket - The socket to send $data to. o $data - The data to be sent. o $flags - The value of $flags can be any combination of the following: possible values for $flags +-----------+----------------------------------+ | | | |STREAM_OOB | | | | | | | Process OOB (out-of-band) data. | | | | +-----------+----------------------------------+ o $address - The address specified when the socket stream was created will be used unless an alternate address is specified in $address. If specified, it must be in dotted quad (or [ipv6]) format. RETURN VALUES
Returns a result code, as an integer. EXAMPLES
Example #1 stream_socket_sendto(3) Example <?php /* Open a socket to port 1234 on localhost */ $socket = stream_socket_client('tcp://127.0.0.1:1234'); /* Send ordinary data via ordinary channels. */ fwrite($socket, "Normal data transmit."); /* Send more data out of band. */ stream_socket_sendto($socket, "Out of Band data.", STREAM_OOB); /* Close it up */ fclose($socket); ?> SEE ALSO
stream_socket_recvfrom(3), stream_socket_client(3), stream_socket_server(3). PHP Documentation Group STREAM_SOCKET_SENDTO(3)
All times are GMT -4. The time now is 06:17 AM.
Unix & Linux Forums Content Copyright 1993-2022. All Rights Reserved.
Privacy Policy