Discussion Board

Results 1 to 2 of 2
  1. #1
    Registered User
    Join Date
    Nov 2007

    Socket could not connect with c# server


    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(""), Convert.ToInt32(15000));

    For Symbian Application:

    void CSocketsEngine::ConstructL()

    // Start a timer
    iTimer = CTimeOutTimer::NewL(EPriorityHigh, *this);

    // Open channel to Socket Server

    // 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("") == KErrNone)
    // server name is already a valid ip 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);

    // Request time out

    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

    // Initiate socket connection
    iSocket.Connect(iAddress, iStatus);

    // Start a timeout


    Plz suggest me what would be the problem. I would be very thankful to all prople.


  2. #2
    Nokia Developer Moderator
    Join Date
    Feb 2006
    Budapest, Hungary

    Re: Socket could not connect with c# server

    Generally your code seems to be OK. However you have probably modified some details (I doubt that the addr.Input("") expression would compile), so the IP address itself might be a problem, especially if the Symbian code runs on the target device (but it should work in the emulator I think).
    You can test the server code using Telnet on your PC. For example I am not sure if the lack of something like mySocket.Accept is a copy-paste problem, or it does not exist at all.

Similar Threads

  1. Connect to BT server using Connect()
    By vinayashrestha in forum Symbian Networking & Messaging (Closed)
    Replies: 4
    Last Post: 2007-12-11, 17:52
  2. socket connect error on S60 2.0 SDK
    By bjtwtx in forum Symbian Networking & Messaging (Closed)
    Replies: 1
    Last Post: 2007-10-15, 13:30
  3. problem in persistant socket connection
    By poms4symbian in forum Browsing and Mark-ups
    Replies: 0
    Last Post: 2006-01-03, 13:23
  4. problem to connect to server on 6630
    By lauyk001 in forum Mobile Java General
    Replies: 5
    Last Post: 2005-07-13, 12:38
  5. http error to connect to Activ server
    By supriya_nandi in forum WAP Servers
    Replies: 2
    Last Post: 2002-11-06, 09:32

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts