Welcome, Guest. Please login or register. Did you miss your activation email?

Show Posts

This section allows you to view all posts made by this member. Note that you can only see posts made in areas you currently have access to.


Messages - KingPenguinator

Pages: [1] 2
1
Okey, i'll see what I can find elsewhere, i'll post back if I find a solution.
As always thanks for the help

2
I've seen the FAQ in the other post, i've tried the suggestions that I could do, but to no avail.

I've tried the FAQ

3
Hey, I saw post smiliar to this one, but it was a bit old, I didn't know if should ask there, or create a new one, so I just created a new one. I've seen the FAQ in the other post, i've tried the suggestions that I could do, but to no avail.

Anyway as the title suggests I can talk to the server when I use my local ip, but when I use my external Ip, or ask a friend to try on his pc it looks like it sends the packet, but the server doesn't receive it.

Client :
string id;
cout << "name: ";
cin >> id;

string ip;
cout << "Ip: ";
cin >> ip;

sf::IpAddress sender(ip) ;
sf::UdpSocket socket;
socket.setBlocking(false);

unsigned short port;
cout << "Port: ";
cin >> port;

socket.bind(port+1);
sf::Packet packet;

sf::Packet sendPacket;
sendPacket << "connection" << id;
socket.send(sendPacket, sender, port);

string connected;
socket.receive(packet, sender, port);
if(packet >> connected)
     if(connected=="done")  //Connection made
      //do stuff
 

Server :
sf::IpAddress sender;
unsigned short port;
socket.receive(packet, sender, port);
if(packet >> commandId)
{
      sf::Packet sendPacket;
      cout << commandId << endl;
      if(commandId=="connection")
      {
            string idStr;
            packet >> idStr;
            cout << idStr << " on " << sender.toString().c_str() << " has connected" << endl;
            //Do stuff
            sendPacket << "done";
            socket.send(sendPacket, sender, port);
       }
}

 

4
Network / Re: Sending string to an e-mail adress
« on: June 19, 2014, 02:12:51 pm »
STARTTLS is for initiating an encrypted session.
See if you can talk to the server on port 25 instead, without encryption.

I tried it, doesn't work, I get the same message, maybe I have to specify I don't want to use it ?

5
Network / Re: Sending string to an e-mail adress
« on: June 19, 2014, 12:52:37 pm »
Ok, so i've modified it a bit, i'm not using packets anymore, and i'm now listening for responses:

#include "iostream"
#include "SFML/Network.hpp"

using namespace std;

int main()
{
    sf::IpAddress ip("smtp.live.com");
    sf::TcpSocket socket;

    if(socket.connect(ip, 587)==sf::Socket::Done)
    {
        cout << "yay" << endl;
    }
    else
        cout << "crap" << endl;

    char helo[100] = "HELO server\r\n";
    socket.send(helo, 100);

    char data[1000];
    size_t received;
    if(socket.receive(data, 1000, received) == sf::Socket::Done)
    {
        cout << data << endl;
    }

    char mailFrom[100] = "MAIL FROM: someone@something.com\r\n";
    socket.send(mailFrom, 100);

    char mailD[1000];
    size_t mailR;
    if(socket.receive(mailD, 1000, mailR) == sf::Socket::Done)
    {
        cout << mailD << endl;
    }

    char rcptTo[100] = "RCPT TO: me@live.com\r\n";
    socket.send(rcptTo, 100);

    char dataC[100] = "DATA\r\n";
    socket.send(dataC, 100);

    char msg[100] = "Message blabablabla\r\n";
    socket.send(msg, 100);

    char endC[100] = "\r\n.\r\n";
    socket.send(endC, 100);

    char dataD[1000]; // I've placed a response listener after every message send, I only get a reponse when I put it here, and not sooner.
    size_t dataR;
    if(socket.receive(dataD, 1000, dataR) == sf::Socket::Done)
    {
        cout << dataD << endl;
    }

    char quit[100] = "QUIT\r\n";
    socket.send(quit, 100);

    return 0;
}

 

Not very clean, but I get a response :
220 BLU436-SMTP168.smtp.hotmail.com Microsoft ESMTP MAIL Service, Version: 8.0.9
200.16384 ready at  Thu, 19 Jun 2014 03:43:19 -0700
o
250 BLU436-SMTP168.smtp.hotmail.com Hello [xxx.xx.xxx.xxx] // This is my ip, I hid it
∟☺
530 5.7.0 Must issue a STARTTLS command first

The problem now is that last line, I don't know how to issue a STARTTLS command, i've tried sending STARTTLS to the server at each possible position, still get this message.

6
Network / Re: Sending string to an e-mail adress
« on: June 18, 2014, 11:00:43 pm »
Thx jespere for the tip, i'll have a look at that tomorrow =)

7
Network / Re: Sending string to an e-mail adress
« on: June 18, 2014, 10:25:55 pm »
Ok, so i'm using packet.clear() between each socket.send(), still not working, I believe the problem is coming from the way i'm sending my messages, I get the feeling they're not right with the SMTP, anyone with any experience with SMTP and C++ could probably see what's up.

8
Network / Re: Sending string to an e-mail adress
« on: June 18, 2014, 10:11:17 pm »
You never clear your packet between two consecutive send, data is accumulating in the packet.

Wasn't sure about that, but i've tried clearing with :
string aux;
packet << "HELO keylog";
socket.send(packet)
packet >> aux;
 

That should clear it right ?

9
Network / Re: Sending string to an e-mail adress
« on: June 18, 2014, 09:52:34 pm »
I should receive an e-mail from the program no ?

10
Network / Re: Sending string to an e-mail adress
« on: June 18, 2014, 09:31:44 pm »
Done this so far:

#include "iostream"
#include "SFML/Network.hpp"

using namespace std;

int main()
{
    sf::IpAddress ip("smtp.live.com");
    sf::TcpSocket socket;

    if(socket.connect(ip, 587)==sf::Socket::Done)
    {
        cout << "yay" << endl;
    }
    else
        cout << "crap" << endl;

    sf::Packet packet;
    packet << "HELO keylog";
    socket.send(packet);

    packet << "MAIL FROM: blank@example.com";
    socket.send(packet);

    packet << "RCPT TO: me@live.com";
    socket.send(packet);

    packet << "DATA";
    socket.send(packet);

    packet << "Message";
    socket.send(packet);

    packet << ".";
    socket.send(packet);

    packet << "QUIT";
    socket.send(packet);

    return 0;
}

 

Not receiving anything, am I forgetting anyting ?

11
Network / Re: Sending string to an e-mail adress
« on: June 18, 2014, 06:58:04 pm »
Ok, i'll see what I can do ^^
Thx

12
Network / Sending string to an e-mail adress
« on: June 18, 2014, 06:42:29 pm »
Hi, is it possible to use the network module in SFML to send an e-mail ?

Like "Hi, blalalalalalla" to example@something.com

13
Network / Re: Trouble receiving ints in classes from packets
« on: June 05, 2014, 02:38:13 pm »
Well, thx for the help.
Now i'm going to have "fun" learning about static_casts and such ;)

14
Network / Re: Trouble receiving ints in classes from packets
« on: June 05, 2014, 02:29:22 pm »
Agreed

15
Network / Re: Trouble receiving ints in classes from packets
« on: June 05, 2014, 02:26:45 pm »
Well the idea was to learn as I go along, I can't know ahead of time what i'm going to need to have learned before the need to have learned it comes.

Pages: [1] 2