import socket, sys, string
if len(sys.argv) !=4 :
print "Usage: ./supabot.py <host> <port> <channel>"
sys.exit(1)
irc = sys.argv[1]
port = int(sys.argv[2])
chan = sys.argv[3]
sck = socket.socket(socket.AF_INET, socket.SOCK_STREAM)
sck.connect((irc, port))
sck.send('NICK supaBOT\r\n')
sck.send('USER supaBOT supaBOT supaBOT :supa...
I'm writing simple server/client in c, where server temporary stores message from client and retrieve it when client request it.
The problem is when client receives message from server, the buffer acts kinda weird.
All i did is read as much as receive from server and print it on the screen, but somehow buffer was overwrited more than ma...
Let me try to clarify my question, I wasn't sure how to word the title. This is purely out of my curiosity.
Between the raw bytes coming over your internet connection and your browser, there are many layers. Each layer adds more structure to the data, eventually ending up as HTML markup. I'm going with the assumption that the final l...
Which socket, the clientSocket = accept() or the listen(socket), do you setsockopt SO_KEEPALIVE on to get the connection to clients not to drop?
...
I have a apache webserver, and we need to develop a module in it (using mod_python or mod_wsgi). It will ofcourse handle the requests sent as http GET/POST. However, we would like this module to ALSO handle messages sent by another remote applications which are NOT http based. That is, the body of the those tcp packets may just be a j...
Hi everyone,
I am trying to make a simple server/client program pair.
On LAN they work fine, but when i try to connect from the "outside" it says connection refused. I shut down firewalls on both machines but i am still unable to connect, and i double checked the ip.
What am i doing wrong?
Thanks
Jake
Code:
import socket
host = ''...
int Socket::Connect(const std::string& host, int port)
{
if(this->_connected)
throw "Socket is already connected";
// Get the IP from the string
hostent* ip = gethostbyname(host.c_str());
/*if(server == NULL)
throw strerror(WSAGetLastError());*/
// Information for WinSock.
sockaddr_in addr;
...
How can I check if a specific ip address or proxy is alive or dead
...
I want to change the IP of every request in a socket connection in php.(to prevent the host from blocking my ip if I sent large number of requests) Iam attaching my code below
function httpGet( $url, $followRedirects=true ) {
global $final_url;
$url_parsed = parse_url($url);
if ( empty($url_parsed['scheme']) ) {
$url_parsed = parse_...
Can anybody explain me what is the difference between the Begin[...]/End[...] asynchronous API pattern and the later [...]Async pattern in .NET 3.5?
Why was the later created?
Why would one prefer one pattern over another?
For example, Socket.BeginAccept() and Socket.AcceptAsync().
...
Is it ever possible for the C send function to return zero when using TCP sockets? The man page just says that it will return the number of bytes sent, but I am not sure if it will just return -1 when it can't send any data.
...
Hi,
I'm trying to download a file using socket and server in java.
myClient = new Socket(address,port);
myClient.setSoTimeout(MyFileManager.TIME_OUT);
in = new DataInputStream(myClient.getInputStream());
out = new DataOutputStream(myClient.getOutputStream());
File requestedFile = new File(_fileManager.getDir()+fileName); //cre...
Hello Friends,
I am using apace http common for sending a request.When sending an http request a connection timeout occurs, the HttpClient.execute method throws a java.net.SocketException instead of a org.apache.http.conn.ConnectionTimeoutException.
ava.net.ConnectException: Connection timed out: connect
at java.net.PlainSocket...
I'm implementing some networking code using the selector pattern in C# / .NET 3.5. However, I was surprised to find that the Select method takes nongeneric IList's rather than IList<Socket>'s. It says clearly in the help documentation though that a list of sockets is expected here and nothing else.
Does anyone know why this is the case...
Hi, In some cases, I'd like to explicitly discard packets waiting on the socket with as little overhead as possible. It seems there's no explicit "drop udp buffer" system call, but maybe I'm wrong?
The next best way would be probably to recv the packet to a temporary buffer and just drop it. It seems I can't receive 0 bytes, since man s...
snippet from The Server code :
public void run() {
try {
// Create data input and output streams
ObjectInputStream inputFromClient = new ObjectInputStream(
socket.getInputStream());
ObjectOutputStream outputToClient = new ObjectOutputStream(
socket.getOutputStream());
...
Hello everyone,
I have several process in my system that need to communicate with each other.
Some of the processes need to pass chunks of data 60 times per second continuously,
and some are very sporadic.
Most of the processes are in C#, one is C++.
All running on the same windows 7 machine.
Right now each process has it's own diff...
Hi All,
I am using an ElSSLSocket from C#. This is a SecureBlackBox socket. SecureBlackBox is a third party library to handle secure sockets.
I can see that the ElSSLSocket object has a property called 'Socket' so the underlying socket is a normal .NET socket.
My question, is there some kind of event that I can subscribe to so that I ...
I am having an application which established a socket connection on a port number 5005 with another device(hardware device with a web server).
Now if my hardware device disconnects then i loose connection with the device.
Does this mean that the socket i was
using until now becomes invalid.
Do i get any special message like
null ...
I'm using perl to write a socket based application. I found that if the client iniate two print
on the socket handle in a way as below:
print $sock "hello kitty";
#do some other stuff
print $sock "hello jack";
the server side can't receive the whole message of "hello kitty". I'm not sure, but strongly suspicious that there are buffer ...