Huy,
i have to transfer text b/w symbian application and server application written in c#. The socket initilization and connection codes are as follow,
For C#:
Socket mySocket = new Socket(AddressFamily.InterNetwork, SocketType.Stream,ProtocolType.Tcp);
IPEndPoint ipep = new IPEndPoint(IPAddress.Parse("127.0.0.1"), Convert.ToInt32(15000));
mySocket.Bind(ipep);
mySocket.Listen(10);
For Symbian Application:
void CSocketsEngine::ConstructL()
{
ChangeStatus(ENotConnected);
// Start a timer
iTimer = CTimeOutTimer::NewL(EPriorityHigh, *this);
CActiveScheduler::Add(this);
// Open channel to Socket Server
User::LeaveIfError(iSocketServ.Connect());
// Create socket read and write active objects
iSocketsReader = CSocketsReader::NewL(*this, iSocket);
iSocketsWriter = CSocketsWriter::NewL(*this, iSocket);
}
void CSocketsEngine::ConnectL()
{
// Initiate connection process
if (iEngineStatus == ENotConnected)
{
TInetAddr addr;
if (addr.Input("127.0.0.1") == KErrNone)
{
// server name is already a valid ip address
ConnectL(addr.Address());
}
else // need to look up name using dns
{
// Initiate DNS
User::LeaveIfError(iResolver.Open(iSocketServ, KAfInet, KProtocolInetUdp));
// DNS request for name resolution
iResolver.GetByName(iServerName, iNameEntry, iStatus);
ChangeStatus(ELookingUp);
// Request time out
iTimer->After(KTimeOut);
SetActive();
}
}
}
void CSocketsEngine::ConnectL(TUint32 aAddr) // <a name="ConnectL32">
{
// Initiate attempt to connect to a socket by IP address
if (iEngineStatus == ENotConnected)
{
// Open a TCP socket
User::LeaveIfError(iSocket.Open(iSocketServ, KAfInet, KSockStream, KProtocolInetTcp));
// Set up address information
iAddress.SetPort(15000);
iAddress.SetAddress(aAddr);
// Initiate socket connection
iSocket.Connect(iAddress, iStatus);
ChangeStatus(EConnecting);
// Start a timeout
iTimer->After(KTimeOut);
SetActive();
}
}
Plz suggest me what would be the problem. I would be very thankful to all prople.
Regards,



