sockets

Socket Connection in iphone

i m calling function "address = CFDataCreate(NULL, (uint8 *)&frameAddr, sizeof(frameAddr));" it runs fine 245 times but it cannot work after that gdb does not give any error can anyone helps me???? ...

GetHostByAddr() win32

Hi All, I am giving an IP Address : 64.78.58.91 and i would like to retrieve the hostname using GetHostByAddr() win32 API. Instead of returning www.ripcode.com it returns intermedia.net I would expect to get www.ripcode.com Can you suggest a Different API which could solve this problem. Thanks in Advance Best Regards, Suren ...

Is there a way to block on a socket send() until we get the ack for that packet?

Or do I have to implement it at the application level? ...

Explain socket buffers please.

Hello! I was trying to find examples about socket programming and came upon this script: http://stacklessexamples.googlecode.com/svn/trunk/examples/networking/mud.py When reading through this script i found this line: listenSocket.listen(5) As i understand it - it reads 5 bytes from the buffer and then does stuff with it... but what...

In TCPServer (Ruby) how can i get the IP/MAC from the client?

Hi, i want to get the IP Address of the client in a TCPServer in Ruby. And (if it is possible) the MAC Address. For example, a Time Server in Ruby, see the comment. tcpserver = TCPServer.new("", 80) if tcpserver puts "Listening" loop do socket = tcpserver.accept if socket Thread.new do puts "Connected from" + # HERE! How c...

TCP Client Server Problem

I have the following code for the server application: TcpListener recSock = new TcpListener(400); recSock.Start(); TcpClient client = recSock.AcceptTcpClient(); NetworkStream netStream = client.GetStream(); Byte[] data = new Byte[256]; int i; while((i = netStream.Read(data, 0, d...

TCP sockets with Zend Framework

Hey everybody, I want to query a WHOIS server with PHP. This means that I have to TCP connect to Port 43 on the WHOIS server. Is there a way to do this with the ZEND Framework? I only found HTTP socket adapters. I will do it with the native PHP socket functions if ZF does not provide wrapper classes. Thank you Lennart ...

How can I avoid raising AddressAlreadyInUseException?

I'm running a WCF service, and calling ServiceHost's Open() method will raise an AddressAlreadyInUseException if the adress is ..err .. already in use ! Is there a way to test whether the address is available without raising an exception? ...

How to access c# sockets server from telnet or SSH?

I've created a very simple sockets server in C# that, when given a number, returns the number doubled. I'm using TCPListener. This server currently works with a simple Winform client I put together, using TCPClient. I tried to connect to the server with Absolute Telnet while it was running. It connects, however the telnet program doe...

Rebol Smallest Http Server in the World: why first wait listen-port ?

In this code web-dir: %./www/ ; the path to rebol www subdirectory listen-port: open/lines tcp://:80 ; port used for web connections buffer: make string! 1024 ; will auto-expand if needed forever [ http-port: first wait listen-port while [not empty? client-request: first http-port][ repend buffer [client-request n...

splice from socket to pipe frozen

This code is based on splice-fromnet.c and splice-cp.c to splice from a socket to a pipe and from the pipe to a file but for some reason the first call to splice never returns. static size_t splice_from_net_to_file(int infd, int outfd) { int p[2]; size_t total = 0; if (pipe(p) == -1) return error("pipe"); while...

C++ IP Address human-readable form

In C/C++, you can use the regular gethostbyname() call to turn a dotted-IP address string ("127.0.0.1" in the case of localhost) into a structure suitable for standard socket calls. Now how do you translate it back? I know I can do some bit-shifting to get exactly which bit sets I want and just print those out, but is there any "standa...

setting the maximum segment size in the tcp header

I am putting together a port scanner as a learning exercise. My problem is I'm trying to set the maximum segment size option(MSS) in the TCP header. I had a look at tcp.h, but I'm having trouble figuring out how to set it. I was hoping there would be an option like this: tcp_header->mss(32000); Something similar to the above was in tc...

Why won't TcpClient.Write throw an exception when writing to a closed connection (the first time)?

I have a simple program that uses TcpClient and SslStream to write data to a socket. To test it I ran the program over night so my program would open the connection, write nothing for a long time, so the firewall or remote server would close the connection. This morning I took a look at TCPView and verified the connection was closed ...

Sending datas repeatedly in a opened Socket Connection (Cocoa)

Hi, Can anybody help me how to create a socket connection using objective c which should remains always open. Also i need to send data to the server in particular time intervals. I followed the following article to create a socket connection. Stream Programming guide for cocoa Using this i created a socket connection and send the data s...

Wrapping BSD select() with JNA

I need to wrap a BSD-like C socket API to Java with JNA. It has basically the same functions as standard BSD socket API. Wrapping select() is problematic because of the fd_set-structure required in its arguments and the FD_* masking functions (macros) that are needed to handle fd_sets. I tried to crawl through the header files (e.g. sys...

Python socket error occured

I wrote this code. import socket host = 'localhost' port = 3794 s = socket.socket(socket.AF_INET, socket.SOCK_DGRAM) s.setsockopt(socket.SOL_SOCKET, socket.SO_REUSEADDR, 1) s.setsockopt(socket.SOL_SOCKET, socket.SO_BROADCAST, 1) s.bind((host, port)) while 1: print 'Type message you want to send...' msg = raw_input() ...

Howto set PHP socket_write and socket_read character encoding?

I'm writing a PHP server and the client is sending data in a specific character encoding. Now, I want to tell the server to read and write data in this same character encoding set. How should I specify the character encoding set for PHP's socket_read and socket_write methods? ...

Native equivalent of NetworkChange class; how to spot IP address changes in Windows

Is there a native Windows API which does the same as the .NET System.Net.NetworkInformation.NetworkChange class? Basically I'm looking for something to report changes to connectivity and IP address changes. ...

setSoTimeout on a client socket doesn't affect the socket

I have a Java application with three threads that open, each, a socket and connect to a server on different ports. I set so_timeout on each of these sockets after the connection to the server is established. After that the threads block waiting on read(). Only one of the threads times out after 20 seconds (which is the timeout I set). Th...