• Open Menu Close Menu
  • Apple
  • Shopping Bag
  • Apple
  • Mac
  • iPad
  • iPhone
  • Watch
  • TV
  • Music
  • Support
  • Search apple.com
  • Shopping Bag
 

Lists

Open Menu Close Menu
  • Terms and Conditions
  • Lists hosted on this site
  • Email the Postmaster
  • Tips for posting to public mailing lists
client/server communication using CFSocket
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

client/server communication using CFSocket


  • Subject: client/server communication using CFSocket
  • From: "Rola Alame" <email@hidden>
  • Date: Thu, 19 Jan 2006 12:24:03 +0000

Hello.

I'm writing two applications: one is a client and the other is a server for them to communicate over the network using TCP/IP. i'm using high level CFSocket function. The client is working fine. however, at the server, i'm successfully creating the socket (with CFSocketCreate), but when i use "CFSocketSetAddress" to bind a port to that socket, it's returning kCFSocketError. and i can't figure out why. Here's the code for the server:

/////////////////////Server.c//////////////////////////

CFSocketRef servere = CFSocketCreate (NULL, PF_INET, SOCK_STREAM, IPPROTO_TCP, kCFSocketConnectCallBack, MyCallBack, NULL);

if (server != NULL)
{
struct sockaddr_in serverAddr;
inet_aton ("192.168.1.11", &serverAddr.sin_addr);
serverAddr.sin_family = AF_INET;
serverAddr.sin_port = htons(2222);
serverAddr.sin_len = sizeof(serverAddr);
CFDataRef address = CFDataCreate (NULL, (UInt8*)&serverAddr, sizeof (serverAddr));
if (address != NULL)
{
CFSocketError err = CFSocketSetAddress (server, address);
if (err == kCFSocketError)
printf("error binding socket to address\n";
}
}


when irun this code i always get the error message printed on the terminal. Can anyone tell me what the problem could be and how to solve it?


Thanks.

Rola


_______________________________________________ Do not post admin requests to the list. They will be ignored. Macnetworkprog mailing list (email@hidden) Help/Unsubscribe/Update your Subscription: This email sent to email@hidden
  • Follow-Ups:
    • Re: client/server communication using CFSocket
      • From: "Justin C. Walker" <email@hidden>
    • Re: client/server communication using CFSocket
      • From: Frederick Cheung <email@hidden>
  • Prev by Date: RE: Function for check Video Resolution
  • Next by Date: Re: client/server communication using CFSocket
  • Previous by thread: RE: Function for check Video Resolution
  • Next by thread: Re: client/server communication using CFSocket
  • Index(es):
    • Date
    • Thread