my Socket.cpp containing
// Implementation of the Socket class.
#include "Socket.h"
#include "string.h"
#include <string.h>
#include <errno.h>
#include <fcntl.h>
Socket::Socket() :
m_sock ( -1 )
{
memset ( &m_addr,
0,
sizeof ( m_addr ) );
}
Socket::~Socket()
{
if ( is_valid() )
::close ( m_sock );
}
bool Socke...
#include "ServerSocket.h"
#include "SocketException.h"
#include <string>
#include<iostream>
int main(int argc, int argv[])
{
std::cout << "running....\n";
try
{
// Create the socket
ServerSocket server ( 30000 );
while ( true )
{
ServerSocket new_sock;
server.accept ( new_sock );
...
Hello,
Visual Studio C++ 2008
I am using this code. However, gethostbyname always returns an error. Everything looks ok to me, so I don't understand why I am getting this error.
This is the code I am using up to getting the gethostbyname.
Any think obvious that I might be doing wrong?
int32_t sockfd;
/* struct definition */
struct ...
I have one problem, I learn how work with socket and I write programm with next code :
import java.net.*;
import java.io.*;
import java.util.*;
public class Client extends Thread{
public static void main(String args[])
{
try
{
Socket s = new Socket(args[0],Integer.parseInt(args[...
I am learning swings for making GUI. I was thinking which is the best possible way in case of socket with swings.
1. The whole swing code goes in the server file. All the handlers and logic in on server side. Client only create socket.
2. The server have logic part. The code for the swing to display interface goes on client side. Client ...
How to play mp3's from socket connections in Flash AS3?
I have some simple programm which is listening to some port (TCP).
I connect to it using as3 sockets and it starts sending me mp3 data
How to play that data?
...
How to use URLRequest to send data to TCP socket in Flash, Actionscript?
So I have TCP server which is listening to some port and on every connection is sending sounds MP3 data to requestor
I've done URLRequest and Sound class plays my sound.
How to send data to that socket not opening new socket connection (using URLRequest or someth...
Hi,
When I try to do a read() on a socket, it works perfectly fine. But, when I put the same thing in a while loop and try to read into a buffer, it stalls my server. Can anyone suggest a solution?
Update:
Thanks for the responses. I was so much into the issue that I assumed everyone else in the world knew what I'm speaking about. Sor...
I'm curious to know if, after a WebSocket has been established (after having received the proper handshake from a server that supports them), whether or not the TCP socket used by the "WebSocket connection" is used exclusively by the WebSocket, or if the browser may still make regular HTTP requests with it.
It only makes sense to me t...
Hi!
I am using php4Delphi in Delphi.
In my PHP script I`m using the function:
$ret = @socket_recv_from(....);
In a normal PHP script ran by either PHP itselfs or Apache this would not give out a warning when the @ operator is present.
But with my application it does anyways...
I am using PHP version 5.3 and newest release of php4De...
Hello all.
I am implementing a UDP data transfer thing. I have several questions about UDP buffer.
I am using UDPClient to do the UDP send / receive. and my broadband bandwidth is 150KB/s (bytes/s, not bps).
I send out a 500B datagram out to 27 hosts
27 hosts send back 10KB datagram back if they receive.
So, I should receive 27 respo...
My program use UdpClient to try to receive 27 responses from 27 hosts. The size of the response is 10KB. My broadband incoming bandwidth is 150KB/s.
The 27 responses are sent from the hosts almost at the same time and for every 10 secs.
However, I can only receive 8 - 17 responses each time. The number of responses that I can receive ...
Hi all
As we know for UDP receive, we use Socket.ReceiveFrom or UdpClient.receive
Socket.ReceiveFrom accept a byte array from you to put the udp data in.
UdpClient.receive returns directly a byte array where the data is
My question is that How to set the buffer size inside Socket. I think the OS maintains its own buffer for receive U...
Is it possible for me to accept a connection and have it die withouit my knowing, then accept another connection on the same socket number?
I've got a thread to do protocol parsing and response creation. I've got another thread to handle all my network IO and one more thread to handle new incomcing connection requests. That makes three ...
As we know for UDP receive, we use Socket.ReceiveFrom or UdpClient.receive
Socket.ReceiveFrom accept a byte array from you to put the udp data in.
UdpClient.receive returns directly a byte array where the data is
My question is that How to set the buffer size inside Socket. I think the OS maintains its own buffer for receive UDP data,...
I have found SocketSniff to be very useful for troubleshooting network applications (like web browsers, email clients, etc). It can sniff wireless and loopback traffic without using a proxy or WinPCap. It will show you only the traffic from the executable you select, which is exactly what I need.
I would love to build and extend a sim...
I created a threaded socket listener that stores newly accepted connections in a queue. The socket threads then read from the queue and respond. For some reason, when doing benchmarking with 'ab' (apache benchmark) using a concurrency of 2 or more, I always get a connection reset before it's able to complete the benchmark (this is taking...
I am trying a program with Swing.
I am using a socket to connect to the server, and the client has the gui code.
public class FactClient extends JFrame implements ActionListener
{
Socket s;
InputStream in;
OutputStream os;
Scanner sin;
PrintWriter out;
JPanel jp;
JTextField jt;
JButton jb;
JLabel jl...
Im getting a connection refused when I try to send some data to my server app using netcat.
server side:
IPAddress ip;
ip = Dns.GetHostEntry("localhost").AddressList[0];
IPEndPoint ipFinal = new IPEndPoint(ip, 12345);
Socket socket = new Socket(AddressFamily.InterNetworkV6, SocketType.Stream, ProtocolType.Tcp);
socket.Bind(ipFinal);
so...
In my application I have a PacketList class and Packet class. I'd like to be able to use the serialization helpers on PacketList to come up with something like the desired output, but have no idea what direction to go in.
I am writing a program to imitate a server which has a peculiar protocol for sending data.
Client sends data with f...